+++ /dev/null
-<?php
-/**
- * Helper file to initialize the rest of MediaWiki.
- *
- * 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
- */
-// Valid web server entry point, enable includes.
-// Please don't move this line to includes/Defines.php. This line essentially
-// defines a valid entry point. If you put it in includes/Defines.php, then
-// any script that includes it becomes an entry point, thereby defeating
-// its purpose.
-define( 'MEDIAWIKI', true );
-
-$wgRequestTime = microtime( true );
-
-// Start the autoloader, so that extensions can derive classes from core files
-require_once "$IP/includes/AutoLoader.php";
-// Load composer's autoloader if present
-if ( is_readable( "$IP/vendor/autoload.php" ) ) {
- require_once "$IP/vendor/autoload.php";
-}
-
-// Load the profiler
-require_once "$IP/includes/profiler/Profiler.php";
-// Start the profiler
-$wgProfiler = array();
-if ( file_exists( "$IP/StartProfiler.php" ) ) {
- require "$IP/StartProfiler.php";
-}
-
-// Load up some global defines.
-require_once "$IP/includes/Defines.php";
-// Load default settings
-require_once "$IP/includes/DefaultSettings.php";
* @param int $ts Optional timestamp to convert, default 0 for the current time
*/
public function expirePassword( $ts = 0 ) {
- $this->load();
+ $this->loadPasswords();
$timestamp = wfTimestamp( TS_MW, $ts );
$this->mPasswordExpires = $timestamp;
$this->saveSettings();
<?php
/**
- * This does the initial set up for a web request, including a few
- * security checks and loading the initializer.
+ * This does the initial set up for a web request.
+ * It does some security checks, starts the profiler and loads the
+ * configuration, and optionally loads Setup.php depending on whether
+ * MW_NO_SETUP is defined.
+ *
+ * Setup.php (if loaded) then sets up GlobalFunctions, the AutoLoader,
+ * and the configuration globals (though not $wgTitle).
*
* 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
# points and when $wgOut gets disabled or overridden.
header( 'X-Content-Type-Options: nosniff' );
+$wgRequestTime = microtime( true );
# getrusage() does not exist on the Microsoft Windows platforms, catching this
$wgRUstart = function_exists( 'getrusage' ) ? getrusage() : array();
unset( $IP );
+# Valid web server entry point, enable includes.
+# Please don't move this line to includes/Defines.php. This line essentially
+# defines a valid entry point. If you put it in includes/Defines.php, then
+# any script that includes it becomes an entry point, thereby defeating
+# its purpose.
+define( 'MEDIAWIKI', true );
+
# Full path to working directory.
# Makes it possible to for example to have effective exclude path in apc.
# __DIR__ breaks symlinked includes, but realpath() returns false
$IP = realpath( '.' ) ?: dirname( __DIR__ );
}
-require_once "$IP/includes/Initialize.php";
+# Start the autoloader, so that extensions can derive classes from core files
+require_once "$IP/includes/AutoLoader.php";
+
+# Load the profiler
+require_once "$IP/includes/profiler/Profiler.php";
+
+# Load up some global defines.
+require_once "$IP/includes/Defines.php";
+
+# Start the profiler
+$wgProfiler = array();
+if ( file_exists( "$IP/StartProfiler.php" ) ) {
+ require "$IP/StartProfiler.php";
+}
wfProfileIn( 'WebStart.php-conf' );
+# Load default settings
+require_once "$IP/includes/DefaultSettings.php";
+
+# Load composer's autoloader if present
+if ( is_readable( "$IP/vendor/autoload.php" ) ) {
+ require_once "$IP/vendor/autoload.php";
+}
+
if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
# Use a callback function to configure MediaWiki
call_user_func( MW_CONFIG_CALLBACK );
# But sometimes this doesn't seem to be the case.
ini_set( 'max_execution_time', 0 );
+ $wgRequestTime = microtime( true );
+
+ # Define us as being in MediaWiki
+ define( 'MEDIAWIKI', true );
+
$wgCommandLineMode = true;
# Turn off output buffering if it's on
// to $maintenance->mSelf. Keep that here for b/c
$self = $maintenance->getName();
-require_once "$IP/includes/Initialize.php";
+# Start the autoloader, so that extensions can derive classes from core files
+require_once "$IP/includes/AutoLoader.php";
+# Stub the profiler
+require_once "$IP/includes/profiler/Profiler.php";
+
+# Start the profiler
+$wgProfiler = array();
+if ( file_exists( "$IP/StartProfiler.php" ) ) {
+ require "$IP/StartProfiler.php";
+}
+
+// Some other requires
+require_once "$IP/includes/Defines.php";
+require_once "$IP/includes/DefaultSettings.php";
+
+# Load composer's autoloader if present
+if ( is_readable( "$IP/vendor/autoload.php" ) ) {
+ require_once "$IP/vendor/autoload.php";
+}
if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
# Use a callback function to configure MediaWiki
$this->mDescription = 'Find registered files with no corresponding file.';
$this->addOption( 'start', 'Starting file name', false, true );
- $this->setBatchSize( 200 );
+ $this->addOption( 'mtimeafter', 'Only include files changed since this time', false, true );
+ $this->addOption( 'mtimebefore', 'Only includes files changed before this time', false, true );
+ $this->setBatchSize( 300 );
}
function execute() {
$dbr = $repo->getSlaveDB();
$be = $repo->getBackend();
+ $mtime1 = $dbr->timestampOrNull( $this->getOption( 'mtimeafter', null ) );
+ $mtime2 = $dbr->timestampOrNull( $this->getOption( 'mtimebefore', null ) );
+
+ $tables = array( 'image' );
+ $logJoinOn = array( 'log_namespace' => NS_FILE, 'log_title = img_name' );
+ $logJoinOn['log_type'] = array( 'upload', 'move', 'delete' );
+ if ( $mtime1 ) {
+ $logJoinOn[] = "log_timestamp > {$dbr->addQuotes($mtime1)}";
+ }
+ if ( $mtime2 ) {
+ $logJoinOn[] = "log_timestamp < {$dbr->addQuotes($mtime2)}";
+ }
+ if ( $mtime1 || $mtime2 ) {
+ $tables[] = 'logging';
+ }
+
do {
- $res = $dbr->select( 'image',
- 'img_name',
+ $res = $dbr->select( $tables,
+ array( 'img_name' => 'DISTINCT(img_name)' ),
array( "img_name >= " . $dbr->addQuotes( $lastName ) ),
__METHOD__,
- array( 'ORDER BY' => 'img_name', 'LIMIT' => $this->mBatchSize )
+ array( 'ORDER BY' => 'img_name', 'LIMIT' => $this->mBatchSize ),
+ array( 'logging' => array( 'INNER JOIN', $logJoinOn ) )
);
// Check if any of these files are missing...