[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/maintenance/ -> Maintenance.php (summary)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

File Size: 1335 lines (37 kb)
Included or required: 144 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

FakeMaintenance:: (5 methods):
  execute()
  __construct()
  execute()
  updateSkippedMessage()
  updatelogFailedMessage()

Defines 5 functions

  __construct()
  shouldExecute()
  addOption()
  hasOption()
  getOption()
  addArg()
  deleteOption()
  addDescription()
  hasArg()
  getArg()
  setBatchSize()
  getName()
  getStdin()
  isQuiet()
  output()
  error()
  cleanupChanneled()
  outputChanneled()
  getDbType()
  addDefaultParams()
  getConfig()
  setConfig()
  runChild()
  setup()
  memoryLimit()
  adjustMemoryLimit()
  clearParamsAndArgs()
  loadParamsAndArgs()
  validateParamsAndArgs()
  loadSpecialVars()
  maybeHelp()
  finalSetup()
  afterFinalSetup()
  globals()
  loadSettings()
  purgeRedundantText()
  getDir()
  getDB()
  setDB()
  lockSearchindex()
  unlockSearchindex()
  relockSearchindex()
  updateSearchIndex()
  updateSearchIndexForPage()
  posix_isatty()
  readconsole()
  readlineEmulation()

Class: FakeMaintenance  - X-Ref

Fake maintenance wrapper, mostly used for the web installer/updater

execute()   X-Ref
No description

__construct()   X-Ref
Class for scripts that perform database maintenance and want to log the
update in `updatelog` so we can later skip it


execute()   X-Ref
No description

updateSkippedMessage()   X-Ref
Message to show that the update was done already and was just skipped

return: string

updatelogFailedMessage()   X-Ref
Message to show the the update log was unable to log the completion of this update

return: string

Functions
Functions that are not part of a class:

__construct()   X-Ref
Default constructor. Children should call this *first* if implementing
their own constructors


shouldExecute()   X-Ref
Should we execute the maintenance script, or just allow it to be included
as a standalone class? It checks that the call stack only includes this
function and "requires" (meaning was called from the file scope)

return: bool

addOption( $name, $description, $required = false,$withArg = false, $shortName = false)   X-Ref
Add a parameter to the script. Will be displayed on --help
with the associated description

param: string $name The name of the param (help, version, etc)
param: string $description The description of the param to show on --help
param: bool $required Is the param required?
param: bool $withArg Is an argument required with this option?
param: string $shortName Character to use as short name

hasOption( $name )   X-Ref
Checks to see if a particular param exists.

param: string $name The name of the param
return: bool

getOption( $name, $default = null )   X-Ref
Get an option, or return the default

param: string $name The name of the param
param: mixed $default Anything you want, default null
return: mixed

addArg( $arg, $description, $required = true )   X-Ref
Add some args that are needed

param: string $arg Name of the arg, like 'start'
param: string $description Short description of the arg
param: bool $required Is this required?

deleteOption( $name )   X-Ref
Remove an option.  Useful for removing options that won't be used in your script.

param: string $name The option to remove.

addDescription( $text )   X-Ref
Set the description text.

param: string $text The text of the description

hasArg( $argId = 0 )   X-Ref
Does a given argument exist?

param: int $argId The integer value (from zero) for the arg
return: bool

getArg( $argId = 0, $default = null )   X-Ref
Get an argument.

param: int $argId The integer value (from zero) for the arg
param: mixed $default The default if it doesn't exist
return: mixed

setBatchSize( $s = 0 )   X-Ref
Set the batch size.

param: int $s The number of operations to do in a batch

getName()   X-Ref
Get the script's name

return: string

getStdin( $len = null )   X-Ref
Return input from stdin.

param: int $len The number of bytes to read. If null, just return the handle.
return: mixed

isQuiet()   X-Ref

return: bool

output( $out, $channel = null )   X-Ref
Throw some output to the user. Scripts can call this with no fears,
as we handle all --quiet stuff here

param: string $out The text to show to the user
param: mixed $channel Unique identifier for the channel. See function outputChanneled.

error( $err, $die = 0 )   X-Ref
Throw an error to the user. Doesn't respect --quiet, so don't use
this for non-error output

param: string $err The error to display
param: int $die If > 0, go ahead and die out using this int as the code

cleanupChanneled()   X-Ref
Clean up channeled output.  Output a newline if necessary.


outputChanneled( $msg, $channel = null )   X-Ref
Message outputter with channeled message support. Messages on the
same channel are concatenated, but any intervening messages in another
channel start a new line.

param: string $msg The message without trailing newline
param: string $channel Channel identifier or null for no

getDbType()   X-Ref
Does the script need different DB access? By default, we give Maintenance
scripts normal rights to the DB. Sometimes, a script needs admin rights
access for a reason and sometimes they want no access. Subclasses should
override and return one of the following values, as needed:
Maintenance::DB_NONE  -  For no DB access at all
Maintenance::DB_STD   -  For normal DB access, default
Maintenance::DB_ADMIN -  For admin DB access

return: int

addDefaultParams()   X-Ref
Add the default parameters to the scripts


getConfig()   X-Ref

return: Config

setConfig( Config $config )   X-Ref

param: Config $config

runChild( $maintClass, $classFile = null )   X-Ref
Run a child maintenance script. Pass all of the current arguments
to it.

param: string $maintClass A name of a child maintenance class
param: string $classFile Full path of where the child is
return: Maintenance

setup()   X-Ref
Do some sanity checking and basic setup


memoryLimit()   X-Ref
Normally we disable the memory_limit when running admin scripts.
Some scripts may wish to actually set a limit, however, to avoid
blowing up unexpectedly. We also support a --memory-limit option,
to allow sysadmins to explicitly set one if they'd prefer to override
defaults (or for people using Suhosin which yells at you for trying
to disable the limits)

return: string

adjustMemoryLimit()   X-Ref
Adjusts PHP's memory limit to better suit our needs, if needed.


clearParamsAndArgs()   X-Ref
Clear all params and arguments.


loadParamsAndArgs( $self = null, $opts = null, $args = null )   X-Ref
Process command line arguments
$mOptions becomes an array with keys set to the option names
$mArgs becomes a zero-based array containing the non-option arguments

param: string $self The name of the script, if any
param: array $opts An array of options, in form of key=>value
param: array $args An array of command line arguments

validateParamsAndArgs()   X-Ref
Run some validation checks on the params, etc


loadSpecialVars()   X-Ref
Handle the special variables that are global to all scripts


maybeHelp( $force = false )   X-Ref
Maybe show the help.

param: bool $force Whether to force the help to show, default false

finalSetup()   X-Ref
Handle some last-minute setup here.


afterFinalSetup()   X-Ref
Execute a callback function at the end of initialisation


globals()   X-Ref
Potentially debug globals. Originally a feature only
for refreshLinks


loadSettings()   X-Ref
Generic setup for most installs. Returns the location of LocalSettings

return: string

purgeRedundantText( $delete = true )   X-Ref
Support function for cleaning up redundant text records

author: Rob Church <[email protected]>
param: bool $delete Whether or not to actually delete the records

getDir()   X-Ref
Get the maintenance directory.

return: string

getDB( $db, $groups = array()   X-Ref
Returns a database to be used by current maintenance script. It can be set by setDB().
If not set, wfGetDB() will be used.
This function has the same parameters as wfGetDB()

return: DatabaseBase

setDB( &$db )   X-Ref
Sets database object to be returned by getDB().

param: DatabaseBase $db Database object to be used

lockSearchindex( &$db )   X-Ref
Lock the search index

param: DatabaseBase &$db

unlockSearchindex( &$db )   X-Ref
Unlock the tables

param: DatabaseBase &$db

relockSearchindex( &$db )   X-Ref
Unlock and lock again
Since the lock is low-priority, queued reads will be able to complete

param: DatabaseBase &$db

updateSearchIndex( $maxLockTime, $callback, $dbw, $results )   X-Ref
Perform a search index update with locking

param: int $maxLockTime The maximum time to keep the search index locked.
param: string $callback The function that will update the function.
param: DatabaseBase $dbw
param: array $results

updateSearchIndexForPage( $dbw, $pageId )   X-Ref
Update the searchindex table for a given pageid

param: DatabaseBase $dbw A database write handle
param: int $pageId The page ID to update.
return: null|string

posix_isatty( $fd )   X-Ref
Wrapper for posix_isatty()
We default as considering stdin a tty (for nice readline methods)
but treating stout as not a tty to avoid color codes

param: int $fd File descriptor
return: bool

readconsole( $prompt = '> ' )   X-Ref
Prompt the console for input

param: string $prompt What to begin the line with, like '> '
return: string Response

readlineEmulation( $prompt )   X-Ref
Emulate readline()

param: string $prompt What to begin the line with, like '> '
return: string



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1