jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/330998 )

Change subject: Fold updateBranchPointers into updateWikiversions
......................................................................


Fold updateBranchPointers into updateWikiversions

It doesn't get run standalone

Change-Id: Iee45963d65c6c7ef59498243f105fb392c72e86d
---
D multiversion/updateBranchPointers
M multiversion/updateWikiversions
2 files changed, 56 insertions(+), 82 deletions(-)

Approvals:
  Krinkle: Looks good to me, but someone else must approve
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/multiversion/updateBranchPointers 
b/multiversion/updateBranchPointers
deleted file mode 100755
index 5eb4747..0000000
--- a/multiversion/updateBranchPointers
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env php
-<?php
-/**
- * Create/update various symlinks used in production.
- *
- * w/static/current links to the latest production branch, respectively.
- * This provides a stable URL to large static assets that are served by
- * extensions and which do not change frequently.
- *
- * php links to the current primary deployed version of MediaWiki.
- *
- * Usage: updateBranchPointers
- */
-error_reporting( E_ALL );
-require_once __DIR__ . '/MWWikiversions.php';
-require_once __DIR__ . '/defines.php';
-
-function isMain() {
-       return basename( __FILE__ ) === basename( $_SERVER['SCRIPT_FILENAME'] );
-}
-
-function updateBranchPointers() {
-       $branchDirs = MWWikiversions::getAvailableBranchDirs();
-
-       if ( !$branchDirs ) {
-               fwrite( STDERR, __FUNCTION__ . ': no deployment branch 
directories found in ' . MEDIAWIKI_DEPLOYMENT_DIR . "\n" );
-               exit( 1 );
-       }
-
-       // Default sort is lexographical which incorrectly sorts e.g. 
[1.23wmf9, 1.23wmf10]
-       usort( $branchDirs, 'version_compare' );
-       $current = array_pop( $branchDirs );
-
-       // Symlink common/php to the current branch using a relative path so 
that
-       // the symlink works from both MEDIAWIKI_STAGING_DIR and
-       // MEDIAWIKI_DEPLOYMENT_DIR
-       $phpLinkTarget = substr( $current, strlen( MEDIAWIKI_DEPLOYMENT_DIR ) + 
1 );
-       updateSymlink( MEDIAWIKI_STAGING_DIR . '/php', $phpLinkTarget );
-}
-
-/**
- * @param string $link
- * @param string $dest
- */
-function updateSymlink( $link, $dest ) {
-       // Change pwd to MEDIAWIKI_STAGING_DIR so that relative paths can be 
verified
-       chdir( MEDIAWIKI_STAGING_DIR );
-
-       if ( !file_exists( $dest ) ) {
-               fwrite( STDERR, __FUNCTION__ . ": link target $dest does not 
exist.\n" );
-               exit( 1 );
-       }
-
-       if ( file_exists( $link ) ) {
-               if ( realpath( $link ) === realpath( $dest ) ) {
-                       echo "$link is already up-to-date.\n";
-                       return;
-               }
-
-               if ( !is_link( $link ) ) {
-                       fwrite( STDERR, __FUNCTION__ . ": $link exists and is 
not a symbolic link.\n" );
-                       exit( 1 );
-               }
-
-               if ( !unlink( $link ) ) {
-                       fwrite( STDERR, __FUNCTION__ . ": failed to unlink 
$link\n" );
-                       exit( 1 );
-               }
-       }
-
-       if ( !symlink( $dest, $link ) ) {
-               fwrite( STDERR, __FUNCTION__ . ": failed to create $link\n" );
-               exit( 1 );
-       }
-       echo "$link => $dest\n";
-}
-
-
-if ( isMain() ) {
-       updateBranchPointers();
-}
diff --git a/multiversion/updateWikiversions b/multiversion/updateWikiversions
index 7411121..ae32287 100755
--- a/multiversion/updateWikiversions
+++ b/multiversion/updateWikiversions
@@ -5,7 +5,6 @@
 require_once __DIR__ . '/defines.php';
 require_once __DIR__ . '/MWWikiversions.php';
 require_once __DIR__ . '/MWRealm.php';
-require_once __DIR__ . '/updateBranchPointers';
 
 /*
  * This script switches all wikis in a .dblist file running one MediaWiki
@@ -69,5 +68,61 @@
        echo "Updated $jsonPath: $inserted inserted, $migrated migrated.\n";
 }
 
+function updateBranchPointers() {
+       $branchDirs = MWWikiversions::getAvailableBranchDirs();
+
+       if ( !$branchDirs ) {
+               fwrite( STDERR, __FUNCTION__ . ': no deployment branch 
directories found in ' . MEDIAWIKI_DEPLOYMENT_DIR . "\n" );
+               exit( 1 );
+       }
+
+       // Default sort is lexographical which incorrectly sorts e.g. 
[1.23wmf9, 1.23wmf10]
+       usort( $branchDirs, 'version_compare' );
+       $current = array_pop( $branchDirs );
+
+       // Symlink common/php to the current branch using a relative path so 
that
+       // the symlink works from both MEDIAWIKI_STAGING_DIR and
+       // MEDIAWIKI_DEPLOYMENT_DIR
+       $phpLinkTarget = substr( $current, strlen( MEDIAWIKI_DEPLOYMENT_DIR ) + 
1 );
+       updateSymlink( MEDIAWIKI_STAGING_DIR . '/php', $phpLinkTarget );
+}
+
+/**
+ * @param string $link
+ * @param string $dest
+ */
+function updateSymlink( $link, $dest ) {
+       // Change pwd to MEDIAWIKI_STAGING_DIR so that relative paths can be 
verified
+       chdir( MEDIAWIKI_STAGING_DIR );
+
+       if ( !file_exists( $dest ) ) {
+               fwrite( STDERR, __FUNCTION__ . ": link target $dest does not 
exist.\n" );
+               exit( 1 );
+       }
+
+       if ( file_exists( $link ) ) {
+               if ( realpath( $link ) === realpath( $dest ) ) {
+                       echo "$link is already up-to-date.\n";
+                       return;
+               }
+
+               if ( !is_link( $link ) ) {
+                       fwrite( STDERR, __FUNCTION__ . ": $link exists and is 
not a symbolic link.\n" );
+                       exit( 1 );
+               }
+
+               if ( !unlink( $link ) ) {
+                       fwrite( STDERR, __FUNCTION__ . ": failed to unlink 
$link\n" );
+                       exit( 1 );
+               }
+       }
+
+       if ( !symlink( $dest, $link ) ) {
+               fwrite( STDERR, __FUNCTION__ . ": failed to create $link\n" );
+               exit( 1 );
+       }
+       echo "$link => $dest\n";
+}
+
 updateWikiversions();
 updateBranchPointers();

-- 
To view, visit https://gerrit.wikimedia.org/r/330998
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iee45963d65c6c7ef59498243f105fb392c72e86d
Gerrit-PatchSet: 2
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to