https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114528
Revision: 114528
Author: jeroendedauw
Date: 2012-03-27 16:43:32 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
Follow up to r114527; actually commit the thing >_>
Added Paths:
-----------
trunk/extensions/EducationProgram/maintenance/deleteEducation.php
Added: trunk/extensions/EducationProgram/maintenance/deleteEducation.php
===================================================================
--- trunk/extensions/EducationProgram/maintenance/deleteEducation.php
(rev 0)
+++ trunk/extensions/EducationProgram/maintenance/deleteEducation.php
2012-03-27 16:43:32 UTC (rev 114528)
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * Maintenance scrtip for deleting all Wikipedia Education Program data.
+ *
+ * @since 0.1
+ *
+ * @file DeleteEducation.php
+ * @ingroup EducationProgram
+ *
+ * @licence GNU GPL v3 or later
+ * @author Jeroen De Dauw < [email protected] >
+ */
+
+$basePath = getenv( 'MW_INSTALL_PATH' ) !== false ? getenv( 'MW_INSTALL_PATH'
) : dirname( __FILE__ ) . '/../../..';
+
+require_once $basePath . '/maintenance/Maintenance.php';
+
+class DeleteEducation extends Maintenance {
+
+ public function __construct() {
+ $this->mDescription = 'Delete the Wikipedia Education Program
data';
+
+ parent::__construct();
+ }
+
+ public function execute() {
+ echo "Are you really really sure you want to delete all EP
date?? If so, type YES\n";
+
+ if ( $this->readconsole() !== 'YES' ) {
+ return;
+ }
+
+ $tables = array(
+ 'orgs',
+ 'courses',
+ 'students',
+ 'users_per_course',
+ 'instructors',
+ 'oas',
+ 'cas',
+ 'articles',
+ 'revisions',
+ );
+
+ $dbw = wfGetDB( DB_MASTER );
+
+ foreach ( $tables as $table ) {
+ $name = "ep_$table";
+
+ echo "Truncating table $name...";
+
+ $dbw->query( 'TRUNCATE TABLE ' . $dbw->tableName( $name
) );
+
+ echo "done!\n";
+ }
+ }
+
+}
+
+$maintClass = 'DeleteEducation';
+require_once( RUN_MAINTENANCE_IF_MAIN );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs