r92845 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92844‎ | r92845 | r92846 >
Date:02:10, 22 July 2011
Author:aaron
Status:ok
Tags:
Comment:
Fixed spelling of refreshWikiversionCDB -> refreshWikiversionsCDB
Modified paths:
  • /trunk/tools/mwmultiversion/multiversion/refreshWikiversionCDB (deleted) (history)
  • /trunk/tools/mwmultiversion/multiversion/refreshWikiversionsCDB (added) (history)

Diff [purge]

Index: trunk/tools/mwmultiversion/multiversion/refreshWikiversionCDB
@@ -1,41 +0,0 @@
2 -#!/usr/bin/env php
3 -<?php
4 -/*
5 - * Populate wikiversions.cdb file using all the items in wikiversions.dat
6 - *
7 - * @return void
8 - */
9 -function refreshWikiversionsCDB() {
10 - $common = '/home/wikipedia/common';
11 -
12 - $path = "$common/wikiversions.dat";
13 - $verList = array_filter( explode( "\n", file_get_contents( $path ) ) );
14 - if ( !count( $verList ) ) {
15 - die( "Unable to read wikiversions.dat.\n" );
16 - }
17 -
18 - $tmpDBPath = "$common/wikiversions.cdb.tmp";
19 - $finalDBPath = "$common/wikiversions.cdb";
20 -
21 - # Build new database at temp location...
22 - $db = dba_open( $tmpDBPath, "n", "cdb_make" );
23 - if ( !$db ) {
24 - die( "Unable to create wikiversions.cdb.\n" );
25 - }
26 - foreach ( $verList as $row ) {
27 - list( $dbName, $version ) = explode( ' ', $row );
28 - dba_insert( $dbName, $version, $db );
29 - }
30 - dba_close( $db );
31 -
32 - # Sanity...
33 - if ( !file_exists( $tmpDBPath ) ) {
34 - die( "Unable to create wikiversions.cdb.\n" );
35 - }
36 -
37 - # Move to final location only when finished...
38 - @unlink( $finalDBPath );
39 - rename( $tmpDBPath, $finalDBPath );
40 -}
41 -
42 -refreshWikiversionsCDB();
Index: trunk/tools/mwmultiversion/multiversion/refreshWikiversionsCDB
@@ -0,0 +1,41 @@
 2+#!/usr/bin/env php
 3+<?php
 4+/*
 5+ * Populate wikiversions.cdb file using all the items in wikiversions.dat
 6+ *
 7+ * @return void
 8+ */
 9+function refreshWikiversionsCDB() {
 10+ $common = '/home/wikipedia/common';
 11+
 12+ $path = "$common/wikiversions.dat";
 13+ $verList = array_filter( explode( "\n", file_get_contents( $path ) ) );
 14+ if ( !count( $verList ) ) {
 15+ die( "Unable to read wikiversions.dat.\n" );
 16+ }
 17+
 18+ $tmpDBPath = "$common/wikiversions.cdb.tmp";
 19+ $finalDBPath = "$common/wikiversions.cdb";
 20+
 21+ # Build new database at temp location...
 22+ $db = dba_open( $tmpDBPath, "n", "cdb_make" );
 23+ if ( !$db ) {
 24+ die( "Unable to create wikiversions.cdb.\n" );
 25+ }
 26+ foreach ( $verList as $row ) {
 27+ list( $dbName, $version ) = explode( ' ', $row );
 28+ dba_insert( $dbName, $version, $db );
 29+ }
 30+ dba_close( $db );
 31+
 32+ # Sanity...
 33+ if ( !file_exists( $tmpDBPath ) ) {
 34+ die( "Unable to create wikiversions.cdb.\n" );
 35+ }
 36+
 37+ # Move to final location only when finished...
 38+ @unlink( $finalDBPath );
 39+ rename( $tmpDBPath, $finalDBPath );
 40+}
 41+
 42+refreshWikiversionsCDB();
Property changes on: trunk/tools/mwmultiversion/multiversion/refreshWikiversionsCDB
___________________________________________________________________
Added: svn:eol-style
143 + native

Status & tagging log