<?php
/**
- * Replication-safe online upgrade script for log_id/log_deleted
+ * Replication-safe online upgrade for log_id/log_deleted fields.
*
* 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
require( __DIR__ . '/../commandLine.inc' );
+/**
+ * Maintenance script that upgrade for log_id/log_deleted fields in a
+ * replication-safe way.
+ *
+ * @ingroup Maintenance
+ */
class UpdateLogging {
/**
-- action field, but only the type controls categorization.
log_type varbinary(10) NOT NULL default '',
log_action varbinary(10) NOT NULL default '',
-
+
-- Timestamp. Duh.
log_timestamp binary(14) NOT NULL default '19700101000000',
-
+
-- The user who performed this action; key to user_id
log_user int unsigned NOT NULL default 0,
-
+
-- Key to the page affected. Where a user is the target,
-- this will point to the user page.
log_namespace int NOT NULL default 0,
log_title varchar(255) binary NOT NULL default '',
-
+
-- Freeform text. Interpreted as edit history comments.
log_comment varchar(255) NOT NULL default '',
-
+
-- LF separated list of miscellaneous parameters
log_params blob NOT NULL,
$minTs = $this->dbw->selectField( $srcTable, 'MIN(log_timestamp)', false, __METHOD__ );
$minTsUnix = wfTimestamp( TS_UNIX, $minTs );
$numRowsCopied = 0;
-
+
while ( true ) {
$maxTs = $this->dbw->selectField( $srcTable, 'MAX(log_timestamp)', false, __METHOD__ );
$copyPos = $this->dbw->selectField( $dstTable, 'MAX(log_timestamp)', false, __METHOD__ );
$percent = ( $copyPosUnix - $minTsUnix ) / ( $maxTsUnix - $minTsUnix ) * 100;
}
printf( "%s %.2f%%\n", $copyPos, $percent );
-
+
# Handle all entries with timestamp equal to $copyPos
if ( $copyPos !== null ) {
$numRowsCopied += $this->copyExactMatch( $srcTable, $dstTable, $copyPos );
*/
/**
- * Create a doxygen subgroup of Maintenance for benchmarks
+ * Base code for benchmark scripts.
*
* 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
*/
require_once( __DIR__ . '/../Maintenance.php' );
+
+/**
+ * Base class for benchmark scripts.
+ *
+ * @ingroup Benchmark
+ */
abstract class Benchmarker extends Maintenance {
private $results;
$this->results[$bench_number] = array(
'function' => $bench['function'],
- 'arguments' => $bench['args'],
+ 'arguments' => $bench['args'],
'count' => $count,
'delta' => $delta,
'average' => $delta / $count,
<?php
/**
- * This come from r75429 message
+ * Benchmark HTTP request vs HTTPS request.
+ *
+ * This come from r75429 message.
*
* 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
*/
require_once( __DIR__ . '/Benchmarker.php' );
+
+/**
+ * Maintenance script that benchmarks HTTP request vs HTTPS request.
+ *
+ * @ingroup Benchmark
+ */
class bench_HTTP_HTTPS extends Benchmarker {
public function __construct() {
<?php
/**
+ * Benchmark SQL DELETE vs SQL TRUNCATE.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
* @ingroup Benchmark
*/
require_once( __DIR__ . '/Benchmarker.php' );
+/**
+ * Maintenance script that benchmarks SQL DELETE vs SQL TRUNCATE.
+ *
+ * @ingroup Benchmark
+ */
class BenchmarkDeleteTruncate extends Benchmarker {
public function __construct() {
<?php
/**
+ * Benchmark if elseif... versus switch case.
+ *
* This come from r75429 message
*
* This program is free software; you can redistribute it and/or modify
*/
require_once( __DIR__ . '/Benchmarker.php' );
+
+/**
+ * Maintenance script that benchmark if elseif... versus switch case.
+ *
+ * @ingroup Maintenance
+ */
class bench_if_switch extends Benchmarker {
public function __construct() {
<?php
/**
+ * Benchmark for strtr() vs str_replace().
+ *
+ * This come from r75429 message.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
* @ingroup Benchmark
*/
return str_replace( '_', ' ', $str );
}
+/**
+ * Maintenance script that benchmarks for strtr() vs str_replace().
+ *
+ * @ingroup Benchmark
+ */
class bench_strtr_str_replace extends Benchmarker {
public function __construct() {
<?php
/**
+ * Benchmark for using a regexp vs. mb_check_encoding to check for UTF-8 encoding.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
* @ingroup Benchmark
*/
require_once( __DIR__ . '/Benchmarker.php' );
/**
- * This little benchmark executes the regexp used in Language->checkTitleEncoding() and compares its execution time
- * against that of mb_check_encoding, if available.
+ * This little benchmark executes the regexp used in Language->checkTitleEncoding()
+ * and compares its execution time against that of mb_check_encoding, if available.
+ *
+ * @ingroup Benchmark
*/
class bench_utf8_title_check extends Benchmarker {
<?php
/**
- * This come from r75429 message
+ * Benchmark for wfIsWindows().
+ *
+ * This come from r75429 message.
*
* 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
*/
require_once( __DIR__ . '/Benchmarker.php' );
+
+/**
+ * Maintenance script that benchmarks wfIsWindows().
+ *
+ * @ingroup Benchmark
+ */
class bench_wfIsWindows extends Benchmarker {
public function __construct() {
<?php
/**
+ * Benchmark %MediaWiki hooks.
+ *
* 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
require_once( __DIR__ . '/Benchmarker.php' );
+/**
+ * Maintenance script that benchmarks %MediaWiki hooks.
+ *
+ * @ingroup Benchmark
+ */
class BenchmarkHooks extends Benchmarker {
public function __construct() {
<?php
/**
- * Squid purge benchmark script
+ * Benchmark for Squid purge.
*
* 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
require_once( __DIR__ . '/Benchmarker.php' );
+/**
+ * Maintenance script that benchmarks Squid purge.
+ *
+ * @ingroup Benchmark
+ */
class BenchmarkPurge extends Benchmarker {
public function __construct() {
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
+ * @file
* @ingroup Maintenance
*/