r70734 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70733‎ | r70734 | r70735 >
Date:02:32, 9 August 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added some code copied from ExtensionDistributor
Modified paths:
  • /trunk/extensions/Distribution/maintenance/getSvnMetadata.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Distribution/maintenance/getSvnMetadata.php
@@ -22,8 +22,10 @@
2323 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2424 * http://www.gnu.org/copyleft/gpl.html
2525 *
 26+ * @since 0.1
 27+ *
2628 * @author Jeroen De Dauw
27 - * @author Yaron Koren
 29+ *
2830 * @ingroup Maintenance
2931 */
3032
@@ -31,20 +33,78 @@
3234
3335 class GetSvnMetadata extends Maintenance {
3436
 37+ /**
 38+ * @var array or false
 39+ */
 40+ protected $extensionList = false;
 41+
 42+ /**
 43+ * @see Maintenance::execute
 44+ *
 45+ * @since 0.1
 46+ */
3547 public function __construct() {
3648 parent::__construct();
3749
3850 $this->mDescription = "Scrapes the WMF SVN repo for package meta-data and stores it so it can be queried via the API.";
3951 }
4052
 53+ /**
 54+ * @see Maintenance::execute
 55+ *
 56+ * @since 0.1
 57+ */
4158 public function execute() {
4259 $dbr = wfGetDB( DB_SLAVE );
4360
44 - // TODO
 61+ $extensions = $this->getExtensionList();
4562
4663 $this->output( "..." );
4764 }
4865
 66+ /**
 67+ * Goes through a local checkout of the svn repository and returns a list
 68+ * with all found extensions. Based on getExtensionList from ExtensionDistributor.
 69+ *
 70+ * @since 0.1
 71+ *
 72+ * @return array
 73+ */
 74+ protected function getExtensionList() {
 75+ global $wgExtDistWorkingCopy, $wgExtDistBranches;
 76+
 77+ if ( $this->extensionList !== false ) {
 78+ return $this->extensionList;
 79+ }
 80+
 81+ $this->extensionList = array();
 82+
 83+ foreach ( $wgExtDistBranches as $branchPath => $branch ) {
 84+ $wc = "$wgExtDistWorkingCopy/$branchPath/extensions";
 85+ $dir = opendir( $wc );
 86+
 87+ if ( !$dir ) {
 88+ return array();
 89+ }
 90+
 91+ $this->extensionList[$branchPath] = array();
 92+
 93+ while ( false !== ( $file = readdir( $dir ) ) ) {
 94+ if ( substr( $file, 0, 1 ) == '.'
 95+ || !is_dir( "$wc/$file" )
 96+ || file_exists( "$wc/$file/NO-DIST" ) ) {
 97+ continue;
 98+ }
 99+
 100+ $this->extensionList[$branchPath][] = $file;
 101+ }
 102+
 103+ natcasesort( $this->extensionList[$branchPath] );
 104+ }
 105+
 106+ return $this->extensionList;
 107+ }
 108+
49109 }
50110
51111 $maintClass = "GetSvnMetadata";

Status & tagging log