Chad has submitted this change and it was merged. Change subject: activeMWVersions.php: Remove script and get info for noc from scap ......................................................................
activeMWVersions.php: Remove script and get info for noc from scap Change-Id: I7a468e2cb105f28a149c1c50ae6ed99d10767827 --- M docroot/noc/conf/activeMWVersions.php M docroot/noc/conf/index.php D multiversion/activeMWVersions.php 3 files changed, 4 insertions(+), 61 deletions(-) Approvals: Chad: Looks good to me, approved jenkins-bot: Verified diff --git a/docroot/noc/conf/activeMWVersions.php b/docroot/noc/conf/activeMWVersions.php index 9141daf..49d862f 100644 --- a/docroot/noc/conf/activeMWVersions.php +++ b/docroot/noc/conf/activeMWVersions.php @@ -1,4 +1,3 @@ <?php -require_once( '/srv/mediawiki/multiversion/activeMWVersions.php' ); -echo implode( ' ', getActiveWikiVersions() ) . "\n"; +echo str_replace( ' ', ', ', exec( '/usr/bin/scap wikiversions-inuse' ) ); diff --git a/docroot/noc/conf/index.php b/docroot/noc/conf/index.php index e705817..b34726a 100644 --- a/docroot/noc/conf/index.php +++ b/docroot/noc/conf/index.php @@ -1,6 +1,4 @@ <?php -require_once( '/srv/mediawiki/multiversion/activeMWVersions.php' ); - function outputFiles( $viewFilenames, $highlight = true ) { $viewFilenames = array_map( 'basename', $viewFilenames ); natsort( $viewFilenames ); @@ -42,7 +40,9 @@ </ul> <hr> -<p>Currently active MediaWiki versions: <?php echo implode( ', ', getActiveWikiVersions() ); ?></p> +<p>Currently active MediaWiki versions: <?php + echo str_replace( ' ', ', ', exec( '/usr/bin/scap wikiversions-inuse' ) ); +?></p> <hr> <h2><img src="./images/source_php.png" alt=""> MediaWiki configuration</h2> diff --git a/multiversion/activeMWVersions.php b/multiversion/activeMWVersions.php deleted file mode 100644 index 57e25e4..0000000 --- a/multiversion/activeMWVersions.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -error_reporting( 0 ); - -require_once( __DIR__ . '/defines.php' ); -require_once( __DIR__ . '/MWRealm.php' ); -require_once( __DIR__ . '/MWWikiversions.php' ); - -/* - * Returns an array of all active MW versions (e.g. "x.xx"). - * Versions are read from /srv/mediawiki/wikiversions.json. - * - * Given --staging, versions are instead read from MEDIAWIKI_STAGING_DIR. - * Given --withdb, each item in the list will be appended with '=' followed by - * the DB name of *some* wiki that uses that version. Used to run maintenance scripts. - * Given --report, error messages would be displayed if this dies. - * - * @return array - */ -function getActiveWikiVersions() { - global $argv; - $options = str_replace( '--home', '--staging', $argv ); // accept '--home' as an alias for '--staging', for back-compat. - array_shift( $options ); // first item is this file - - if ( in_array( '--staging', $options ) ) { - $jsonPath = getRealmSpecificFilename( MEDIAWIKI_STAGING_DIR . '/wikiversions.json' ); - } else { - $jsonPath = getRealmSpecificFilename( MEDIAWIKI_DEPLOYMENT_DIR . '/wikiversions.json' ); - } - - # Get all the wikiversion rows in wikiversions.json... - try { - $versionRows = MWWikiversions::readWikiVersionsFile( $jsonPath ); - } catch( Exception $e ) { - if ( in_array( '--report', $options ) ) { - throw $e; // show error - } else { - die( 1 ); // silent death - } - } - $result = $activeVersions = array(); - foreach ( $versionRows as $dbName => $version ) { - if ( !isset( $activeVersions[$version] ) ) { // already listed? - $activeVersions[$version] = 1; - - $version = substr( $version, 4 ); // remove 'php-' - if ( in_array( '--withdb', $options ) ) { - $result[] = "{$version}={$dbName}"; - } else { - $result[] = "{$version}"; - } - } - - } - - return $result; -} -- To view, visit https://gerrit.wikimedia.org/r/309372 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7a468e2cb105f28a149c1c50ae6ed99d10767827 Gerrit-PatchSet: 2 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits