* Fix array logic in Sanitizer::removeHTMLtags so that it doesn't strip good tags
that were redundantly defined.
* (bug 14118) SpecialPage::getTitleFor does not return a localised name
+* (bug 18698) Renaming non entry point maintenance scripts from .inc.php to .inc
== API changes in 1.16 ==
-Release 1.0.10
---------------
-* bug fix: changes hashing function to crc32, sprintf %u
-* feature: optional compression
+09 Oct 2003:
+ 1455 UTC:
+ Released version 0.1.2
+ Fixed bug in get_multi; when debugging was enabled but no keys were fetched,
+ script execution would halt (uninitialized $val)
-Release 1.0.9
--------------
-* protocol parsing bug
+08 Oct 2003:
+ 1848 UTC:
+ Released version 0.1.1
-Release 1.0.8
--------------
-* whitespace/punctuation/wording cleanups
+ 1825 UTC:
+ Fixed bug in memcached::memcached; was attempting to initialize
+ memcached::_dead_sock (function) instead of memcached::_dead_hosts
+ (oops!)
-Release 1.0.7
--------------
-* added 3 functions which handle error reporting
- error() - returns error number of last error generated, else returns 0
- error_string() - returns a string description of error number retuned
- error_clear() - clears the last error number and error string
-* removed call to preg_match() in _loaditems()
-* only non-scalar values are serialize() before being
- sent to the server
-* added the optional timestamp argument for delete()
- read Documentation file for details
-* PHPDocs/PEAR style comments added
-* abstract debugging (Brion Vibber <brion@pobox.com>)
-
-Release 1.0.6
--------------
-* removed all array_push() calls
-* applied patch provided by Stuart Herbert<stuart@gentoo.org>
- corrects possible endless loop. Available at
- http://bugs.gentoo.org/show_bug.cgi?id=25385
-* fixed problem with storing large binary files
-* added more error checking, specifically on all socket functions
-* added support for the INCR and DECR commands
- which increment or decrement a value stored in MemCached
-* Documentation removed from source and is now available
- in the file Documentation
+ 1812 UTC:
+ Fixed memcached::enable_compression;
+ thanks to Justin Matlock <jmat@shutdown.net> for pointing it out
+
+07 Oct 2003:
+ 1635 UTC:
+ Fixed call to memcached::_dead_sock in memcached::delete
+ Added documentation for class variable $_buckets
+
+06 Oct 2003:
+ 2039 UTC:
+ Initial release of memcached-client-php; version 0.1
-Release 1.0.4
--------------
-* initial release, version numbers kept
- in sync with MemCached version
-* capable of storing any datatype in MemCached
--- /dev/null
+HTML documentation is under http://phpca.cytherianage.net/memcached/doc/
--- /dev/null
+<?php
+
+/**
+ * Support functions for the deleteOrphanedRevisions maintenance script
+ *
+ * @file
+ * @ingroup Maintenance
+ * @author Rob Church <robchur@gmail.com>
+ */
+
+/**
+ * Delete one or more revisions from the database
+ * Do this inside a transaction
+ *
+ * @param $id Array of revision id values
+ * @param $db Database class (needs to be a master)
+ */
+function deleteRevisions( $id, &$dbw ) {
+ if( !is_array( $id ) )
+ $id = array( $id );
+ $dbw->delete( 'revision', array( 'rev_id' => $id ), 'deleteRevision' );
+}
+
+/**
+ * Spit out script usage information and exit
+ */
+function showUsage() {
+ echo( "Finds revisions which refer to nonexisting pages and deletes them from the database\n" );
+ echo( "USAGE: php deleteOrphanedRevisions.php [--report]\n\n" );
+ echo( " --report : Prints out a count of affected revisions but doesn't delete them\n\n" );
+}
+
+++ /dev/null
-<?php
-
-/**
- * Support functions for the deleteOrphanedRevisions maintenance script
- *
- * @file
- * @ingroup Maintenance
- * @author Rob Church <robchur@gmail.com>
- */
-
-/**
- * Delete one or more revisions from the database
- * Do this inside a transaction
- *
- * @param $id Array of revision id values
- * @param $db Database class (needs to be a master)
- */
-function deleteRevisions( $id, &$dbw ) {
- if( !is_array( $id ) )
- $id = array( $id );
- $dbw->delete( 'revision', array( 'rev_id' => $id ), 'deleteRevision' );
-}
-
-/**
- * Spit out script usage information and exit
- */
-function showUsage() {
- echo( "Finds revisions which refer to nonexisting pages and deletes them from the database\n" );
- echo( "USAGE: php deleteOrphanedRevisions.php [--report]\n\n" );
- echo( " --report : Prints out a count of affected revisions but doesn't delete them\n\n" );
-}
-
$options = array( 'report', 'help' );
require_once( 'commandLine.inc' );
-require_once( 'deleteOrphanedRevisions.inc.php' );
+require_once( 'deleteOrphanedRevisions.inc' );
echo( "Delete Orphaned Revisions\n" );
if( isset( $options['help'] ) ) {
--- /dev/null
+<?php
+
+/**
+ * Support functions for the importImages script
+ *
+ * @file
+ * @ingroup Maintenance
+ * @author Rob Church <robchur@gmail.com>
+ */
+
+/**
+ * Search a directory for files with one of a set of extensions
+ *
+ * @param $dir Path to directory to search
+ * @param $exts Array of extensions to search for
+ * @return mixed Array of filenames on success, or false on failure
+ */
+function findFiles( $dir, $exts ) {
+ if( is_dir( $dir ) ) {
+ if( $dhl = opendir( $dir ) ) {
+ while( ( $file = readdir( $dhl ) ) !== false ) {
+ if( is_file( $dir . '/' . $file ) ) {
+ list( /* $name */, $ext ) = splitFilename( $dir . '/' . $file );
+ if( array_search( strtolower( $ext ), $exts ) !== false )
+ $files[] = $dir . '/' . $file;
+ }
+ }
+ return $files;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+}
+
+/**
+ * Split a filename into filename and extension
+ *
+ * @param $filename Filename
+ * @return array
+ */
+function splitFilename( $filename ) {
+ $parts = explode( '.', $filename );
+ $ext = $parts[ count( $parts ) - 1 ];
+ unset( $parts[ count( $parts ) - 1 ] );
+ $fname = implode( '.', $parts );
+ return array( $fname, $ext );
+}
+
+/**
+ * Find an auxilliary file with the given extension, matching
+ * the give base file path. $maxStrip determines how many extensions
+ * may be stripped from the original file name before appending the
+ * new extension. For example, with $maxStrip = 1 (the default),
+ * file files acme.foo.bar.txt and acme.foo.txt would be auxilliary
+ * files for acme.foo.bar and the extension ".txt". With $maxStrip = 2,
+ * acme.txt would also be acceptable.
+ *
+ * @param $file base path
+ * @param $auxExtension the extension to be appended to the base path
+ * @param $maxStrip the maximum number of extensions to strip from the base path (default: 1)
+ * @return string or false
+ */
+function findAuxFile( $file, $auxExtension, $maxStrip = 1 ) {
+ if ( strpos( $auxExtension, '.' ) !== 0 ) {
+ $auxExtension = '.' . $auxExtension;
+ }
+
+ $d = dirname( $file );
+ $n = basename( $file );
+
+ while ( $maxStrip >= 0 ) {
+ $f = $d . '/' . $n . $auxExtension;
+
+ if ( file_exists( $f ) ) {
+ return $f;
+ }
+
+ $idx = strrpos( $n, '.' );
+ if ( !$idx ) break;
+
+ $n = substr( $n, 0, $idx );
+ $maxStrip -= 1;
+ }
+
+ return false;
+}
\ No newline at end of file
+++ /dev/null
-<?php
-
-/**
- * Support functions for the importImages script
- *
- * @file
- * @ingroup Maintenance
- * @author Rob Church <robchur@gmail.com>
- */
-
-/**
- * Search a directory for files with one of a set of extensions
- *
- * @param $dir Path to directory to search
- * @param $exts Array of extensions to search for
- * @return mixed Array of filenames on success, or false on failure
- */
-function findFiles( $dir, $exts ) {
- if( is_dir( $dir ) ) {
- if( $dhl = opendir( $dir ) ) {
- while( ( $file = readdir( $dhl ) ) !== false ) {
- if( is_file( $dir . '/' . $file ) ) {
- list( /* $name */, $ext ) = splitFilename( $dir . '/' . $file );
- if( array_search( strtolower( $ext ), $exts ) !== false )
- $files[] = $dir . '/' . $file;
- }
- }
- return $files;
- } else {
- return false;
- }
- } else {
- return false;
- }
-}
-
-/**
- * Split a filename into filename and extension
- *
- * @param $filename Filename
- * @return array
- */
-function splitFilename( $filename ) {
- $parts = explode( '.', $filename );
- $ext = $parts[ count( $parts ) - 1 ];
- unset( $parts[ count( $parts ) - 1 ] );
- $fname = implode( '.', $parts );
- return array( $fname, $ext );
-}
-
-/**
- * Find an auxilliary file with the given extension, matching
- * the give base file path. $maxStrip determines how many extensions
- * may be stripped from the original file name before appending the
- * new extension. For example, with $maxStrip = 1 (the default),
- * file files acme.foo.bar.txt and acme.foo.txt would be auxilliary
- * files for acme.foo.bar and the extension ".txt". With $maxStrip = 2,
- * acme.txt would also be acceptable.
- *
- * @param $file base path
- * @param $auxExtension the extension to be appended to the base path
- * @param $maxStrip the maximum number of extensions to strip from the base path (default: 1)
- * @return string or false
- */
-function findAuxFile( $file, $auxExtension, $maxStrip = 1 ) {
- if ( strpos( $auxExtension, '.' ) !== 0 ) {
- $auxExtension = '.' . $auxExtension;
- }
-
- $d = dirname( $file );
- $n = basename( $file );
-
- while ( $maxStrip >= 0 ) {
- $f = $d . '/' . $n . $auxExtension;
-
- if ( file_exists( $f ) ) {
- return $f;
- }
-
- $idx = strrpos( $n, '.' );
- if ( !$idx ) break;
-
- $n = substr( $n, 0, $idx );
- $maxStrip -= 1;
- }
-
- return false;
-}
\ No newline at end of file
$optionsWithArgs = array( 'extensions', 'comment', 'comment-file', 'comment-ext', 'user', 'license' );
require_once( 'commandLine.inc' );
-require_once( 'importImages.inc.php' );
+require_once( 'importImages.inc' );
$added = $skipped = $overwritten = 0;
echo( "Import Images\n\n" );
--- /dev/null
+<?php
+
+/**
+ * Support functions for the reassignEdits script
+ *
+ * @file
+ * @ingroup Maintenance
+ * @author Rob Church <robchur@gmail.com>
+ * @licence GNU General Public Licence 2.0 or later
+ */
+
+/**
+ * Reassign edits from one user to another
+ *
+ * @param $from User to take edits from
+ * @param $to User to assign edits to
+ * @param $rc Update the recent changes table
+ * @param $report Don't change things; just echo numbers
+ * @return integer Number of entries changed, or that would be changed
+ */
+function reassignEdits( &$from, &$to, $rc = false, $report = false ) {
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->immediateBegin();
+ $fname = 'reassignEdits';
+
+ # Count things
+ out( "Checking current edits..." );
+ $res = $dbw->select( 'revision', 'COUNT(*) AS count', userConditions( $from, 'rev_user', 'rev_user_text' ), $fname );
+ $row = $dbw->fetchObject( $res );
+ $cur = $row->count;
+ out( "found {$cur}.\n" );
+
+ out( "Checking deleted edits..." );
+ $res = $dbw->select( 'archive', 'COUNT(*) AS count', userConditions( $from, 'ar_user', 'ar_user_text' ), $fname );
+ $row = $dbw->fetchObject( $res );
+ $del = $row->count;
+ out( "found {$del}.\n" );
+
+ # Don't count recent changes if we're not supposed to
+ if( $rc ) {
+ out( "Checking recent changes..." );
+ $res = $dbw->select( 'recentchanges', 'COUNT(*) AS count', userConditions( $from, 'rc_user', 'rc_user_text' ), $fname );
+ $row = $dbw->fetchObject( $res );
+ $rec = $row->count;
+ out( "found {$rec}.\n" );
+ } else {
+ $rec = 0;
+ }
+
+ $total = $cur + $del + $rec;
+ out( "\nTotal entries to change: {$total}\n" );
+
+ if( !$report ) {
+ if( $total ) {
+ # Reassign edits
+ out( "\nReassigning current edits..." );
+ $res = $dbw->update( 'revision', userSpecification( $to, 'rev_user', 'rev_user_text' ), userConditions( $from, 'rev_user', 'rev_user_text' ), $fname );
+ out( "done.\nReassigning deleted edits..." );
+ $res = $dbw->update( 'archive', userSpecification( $to, 'ar_user', 'ar_user_text' ), userConditions( $from, 'ar_user', 'ar_user_text' ), $fname );
+ out( "done.\n" );
+ # Update recent changes if required
+ if( $rc ) {
+ out( "Updating recent changes..." );
+ $res = $dbw->update( 'recentchanges', userSpecification( $to, 'rc_user', 'rc_user_text' ), userConditions( $from, 'rc_user', 'rc_user_text' ), $fname );
+ out( "done.\n" );
+ }
+ }
+ }
+
+ $dbw->immediateCommit();
+ return (int)$total;
+}
+
+/**
+ * Return the most efficient set of user conditions
+ * i.e. a user => id mapping, or a user_text => text mapping
+ *
+ * @param $user User for the condition
+ * @param $idfield Field name containing the identifier
+ * @param $utfield Field name containing the user text
+ * @return array
+ */
+function userConditions( &$user, $idfield, $utfield ) {
+ return $user->getId() ? array( $idfield => $user->getId() ) : array( $utfield => $user->getName() );
+}
+
+/**
+ * Return user specifications
+ * i.e. user => id, user_text => text
+ *
+ * @param $user User for the spec
+ * @param $idfield Field name containing the identifier
+ * @param $utfield Field name containing the user text
+ * @return array
+ */
+function userSpecification( &$user, $idfield, $utfield ) {
+ return array( $idfield => $user->getId(), $utfield => $user->getName() );
+}
+
+/**
+ * Echo output if $wgSilent is off
+ *
+ * @param $output Output to echo
+ * @return bool True if the output was echoed
+ */
+function out( $output ) {
+ global $wgSilent;
+ if( !$wgSilent ) {
+ echo( $output );
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/**
+ * Mutator for $wgSilent
+ *
+ * @param $silent Switch on $wgSilent
+ */
+function silent( $silent = true ) {
+ global $wgSilent;
+ $wgSilent = $silent;
+}
+
+/**
+ * Initialise the user object
+ *
+ * @param $username Username or IP address
+ * @return User
+ */
+function initialiseUser( $username ) {
+ if( User::isIP( $username ) ) {
+ $user = new User();
+ $user->setId( 0 );
+ $user->setName( $username );
+ } else {
+ $user = User::newFromName( $username );
+ }
+ $user->load();
+ return $user;
+}
+
+++ /dev/null
-<?php
-
-/**
- * Support functions for the reassignEdits script
- *
- * @file
- * @ingroup Maintenance
- * @author Rob Church <robchur@gmail.com>
- * @licence GNU General Public Licence 2.0 or later
- */
-
-/**
- * Reassign edits from one user to another
- *
- * @param $from User to take edits from
- * @param $to User to assign edits to
- * @param $rc Update the recent changes table
- * @param $report Don't change things; just echo numbers
- * @return integer Number of entries changed, or that would be changed
- */
-function reassignEdits( &$from, &$to, $rc = false, $report = false ) {
- $dbw = wfGetDB( DB_MASTER );
- $dbw->immediateBegin();
- $fname = 'reassignEdits';
-
- # Count things
- out( "Checking current edits..." );
- $res = $dbw->select( 'revision', 'COUNT(*) AS count', userConditions( $from, 'rev_user', 'rev_user_text' ), $fname );
- $row = $dbw->fetchObject( $res );
- $cur = $row->count;
- out( "found {$cur}.\n" );
-
- out( "Checking deleted edits..." );
- $res = $dbw->select( 'archive', 'COUNT(*) AS count', userConditions( $from, 'ar_user', 'ar_user_text' ), $fname );
- $row = $dbw->fetchObject( $res );
- $del = $row->count;
- out( "found {$del}.\n" );
-
- # Don't count recent changes if we're not supposed to
- if( $rc ) {
- out( "Checking recent changes..." );
- $res = $dbw->select( 'recentchanges', 'COUNT(*) AS count', userConditions( $from, 'rc_user', 'rc_user_text' ), $fname );
- $row = $dbw->fetchObject( $res );
- $rec = $row->count;
- out( "found {$rec}.\n" );
- } else {
- $rec = 0;
- }
-
- $total = $cur + $del + $rec;
- out( "\nTotal entries to change: {$total}\n" );
-
- if( !$report ) {
- if( $total ) {
- # Reassign edits
- out( "\nReassigning current edits..." );
- $res = $dbw->update( 'revision', userSpecification( $to, 'rev_user', 'rev_user_text' ), userConditions( $from, 'rev_user', 'rev_user_text' ), $fname );
- out( "done.\nReassigning deleted edits..." );
- $res = $dbw->update( 'archive', userSpecification( $to, 'ar_user', 'ar_user_text' ), userConditions( $from, 'ar_user', 'ar_user_text' ), $fname );
- out( "done.\n" );
- # Update recent changes if required
- if( $rc ) {
- out( "Updating recent changes..." );
- $res = $dbw->update( 'recentchanges', userSpecification( $to, 'rc_user', 'rc_user_text' ), userConditions( $from, 'rc_user', 'rc_user_text' ), $fname );
- out( "done.\n" );
- }
- }
- }
-
- $dbw->immediateCommit();
- return (int)$total;
-}
-
-/**
- * Return the most efficient set of user conditions
- * i.e. a user => id mapping, or a user_text => text mapping
- *
- * @param $user User for the condition
- * @param $idfield Field name containing the identifier
- * @param $utfield Field name containing the user text
- * @return array
- */
-function userConditions( &$user, $idfield, $utfield ) {
- return $user->getId() ? array( $idfield => $user->getId() ) : array( $utfield => $user->getName() );
-}
-
-/**
- * Return user specifications
- * i.e. user => id, user_text => text
- *
- * @param $user User for the spec
- * @param $idfield Field name containing the identifier
- * @param $utfield Field name containing the user text
- * @return array
- */
-function userSpecification( &$user, $idfield, $utfield ) {
- return array( $idfield => $user->getId(), $utfield => $user->getName() );
-}
-
-/**
- * Echo output if $wgSilent is off
- *
- * @param $output Output to echo
- * @return bool True if the output was echoed
- */
-function out( $output ) {
- global $wgSilent;
- if( !$wgSilent ) {
- echo( $output );
- return true;
- } else {
- return false;
- }
-}
-
-/**
- * Mutator for $wgSilent
- *
- * @param $silent Switch on $wgSilent
- */
-function silent( $silent = true ) {
- global $wgSilent;
- $wgSilent = $silent;
-}
-
-/**
- * Initialise the user object
- *
- * @param $username Username or IP address
- * @return User
- */
-function initialiseUser( $username ) {
- if( User::isIP( $username ) ) {
- $user = new User();
- $user->setId( 0 );
- $user->setName( $username );
- } else {
- $user = User::newFromName( $username );
- }
- $user->load();
- return $user;
-}
-
$options = array( 'force', 'norc', 'quiet', 'report' );
require_once( 'commandLine.inc' );
-require_once( 'reassignEdits.inc.php' );
+require_once( 'reassignEdits.inc' );
# Set silent mode; --report overrides --quiet
if( !@$options['report'] && @$options['quiet'] )
--- /dev/null
+<?php
+/**
+ * Support class for the updateArticleCount.php maintenance script
+ *
+ * @file
+ * @ingroup Maintenance
+ * @author Rob Church <robchur@gmail.com>
+ */
+
+class ArticleCounter {
+
+ var $dbr;
+ var $namespaces;
+
+ function ArticleCounter() {
+ global $wgContentNamespaces;
+ $this->namespaces = $wgContentNamespaces;
+ $this->dbr = wfGetDB( DB_SLAVE );
+ }
+
+ /**
+ * Produce a comma-delimited set of namespaces
+ * Includes paranoia
+ *
+ * @return string
+ */
+ function makeNsSet() {
+ foreach( $this->namespaces as $namespace )
+ $namespaces[] = intval( $namespace );
+ return implode( ', ', $namespaces );
+ }
+
+ /**
+ * Produce SQL for the query
+ *
+ * @return string
+ */
+ function makeSql() {
+ list( $page, $pagelinks ) = $this->dbr->tableNamesN( 'page', 'pagelinks' );
+ $nsset = $this->makeNsSet();
+ return "SELECT COUNT(DISTINCT page_namespace, page_title) AS pagecount " .
+ "FROM $page, $pagelinks " .
+ "WHERE pl_from=page_id and page_namespace IN ( $nsset ) " .
+ "AND page_is_redirect = 0 AND page_len > 0";
+ }
+
+ /**
+ * Count the number of valid content pages in the wiki
+ *
+ * @return mixed Integer, or false if there's a problem
+ */
+ function count() {
+ $res = $this->dbr->query( $this->makeSql(), __METHOD__ );
+ $row = $this->dbr->fetchObject( $res );
+ $this->dbr->freeResult( $res );
+ return $row->pagecount;
+ }
+
+}
+
+
+++ /dev/null
-<?php
-/**
- * Support class for the updateArticleCount.php maintenance script
- *
- * @file
- * @ingroup Maintenance
- * @author Rob Church <robchur@gmail.com>
- */
-
-class ArticleCounter {
-
- var $dbr;
- var $namespaces;
-
- function ArticleCounter() {
- global $wgContentNamespaces;
- $this->namespaces = $wgContentNamespaces;
- $this->dbr = wfGetDB( DB_SLAVE );
- }
-
- /**
- * Produce a comma-delimited set of namespaces
- * Includes paranoia
- *
- * @return string
- */
- function makeNsSet() {
- foreach( $this->namespaces as $namespace )
- $namespaces[] = intval( $namespace );
- return implode( ', ', $namespaces );
- }
-
- /**
- * Produce SQL for the query
- *
- * @return string
- */
- function makeSql() {
- list( $page, $pagelinks ) = $this->dbr->tableNamesN( 'page', 'pagelinks' );
- $nsset = $this->makeNsSet();
- return "SELECT COUNT(DISTINCT page_namespace, page_title) AS pagecount " .
- "FROM $page, $pagelinks " .
- "WHERE pl_from=page_id and page_namespace IN ( $nsset ) " .
- "AND page_is_redirect = 0 AND page_len > 0";
- }
-
- /**
- * Count the number of valid content pages in the wiki
- *
- * @return mixed Integer, or false if there's a problem
- */
- function count() {
- $res = $this->dbr->query( $this->makeSql(), __METHOD__ );
- $row = $this->dbr->fetchObject( $res );
- $this->dbr->freeResult( $res );
- return $row->pagecount;
- }
-
-}
-
-
$options = array( 'update', 'help' );
require_once( 'commandLine.inc' );
-require_once( 'updateArticleCount.inc.php' );
+require_once( 'updateArticleCount.inc' );
echo( "Update Article Count\n\n" );
if( isset( $options['help'] ) && $options['help'] ) {