Chad has uploaded a new change for review. (
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
---
M multiversion/updateBranchPointers
M multiversion/updateWikiversions
2 files changed, 56 insertions(+), 56 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config
refs/changes/98/330998/1
diff --git a/multiversion/updateBranchPointers
b/multiversion/updateBranchPointers
index 5eb4747..5ed6a1d 100755
--- a/multiversion/updateBranchPointers
+++ b/multiversion/updateBranchPointers
@@ -19,61 +19,6 @@
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() ) {
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: newchange
Gerrit-Change-Id: Iee45963d65c6c7ef59498243f105fb392c72e86d
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits