blob: 561c94800a806782dc38aa5e827da2b5002229f8 [file] [log] [blame]
#!/usr/bin/env php
<?php
/**
* Run updates for just this extension.
*
* @file
* @todo document
* @ingroup Maintenance
*/
namespace HitCounters;
use Maintenance;
# Stolen from WebStart.php, assuming you're running this in root
$IP = getenv( 'MW_INSTALL_PATH' );
if ( $IP === false ) {
$IP = realpath( '.' ) ?: dirname( __DIR__ );
}
require_once "$IP/maintenance/Maintenance.php";
/**
* Maintenance script to run database schema updates.
*
* @ingroup Maintenance
*/
class UpdateHitCounter extends Maintenance {
public function __construct() {
parent::__construct();
$this->requireExtension( 'HitCounters' );
}
public function execute() {
# Attempt to connect to the database as a privileged user
# This will vomit up an error if there are permissions problems
$dbconn = $this->getDB( DB_PRIMARY );
$shared = $this->hasOption( 'doshared' );
$updater = HCUpdater::newForDb( $dbconn, $shared, $this );
$updater->clearExtensionUpdates();
HCUpdater::getDBUpdates( $updater );
$updater->doUpdates( [ 'extensions' ] );
}
}
$maintClass = UpdateHitCounter::class;
require_once RUN_MAINTENANCE_IF_MAIN;
  NODES
todo 1