Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/88753


Change subject: Install and update the store when needed [DNM, DRAFT]
......................................................................

Install and update the store when needed [DNM, DRAFT]

Change-Id: I4bade485ae35df389c46e15605f78ecd296ff155
---
M src/Wikibase/Query/Setup/SchemaUpdater.php
1 file changed, 35 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQuery 
refs/changes/53/88753/1

diff --git a/src/Wikibase/Query/Setup/SchemaUpdater.php 
b/src/Wikibase/Query/Setup/SchemaUpdater.php
index a4ec6ca..0abe70c 100644
--- a/src/Wikibase/Query/Setup/SchemaUpdater.php
+++ b/src/Wikibase/Query/Setup/SchemaUpdater.php
@@ -2,12 +2,45 @@
 
 namespace Wikibase\Query\Setup;
 
+use DatabaseUpdater;
+
 /**
  * @licence GNU GPL v2+
  * @author Jeroen De Dauw < jeroended...@gmail.com >
  */
 class SchemaUpdater {
 
-       // TODO
+       /**
+        * @var DatabaseUpdater
+        */
+       protected $updater;
 
-}
\ No newline at end of file
+       public function __construct() {
+               // TODO
+       }
+
+       public function run( DatabaseUpdater $updater ) {
+               $this->updater = $updater;
+
+               $this->applyUpdateIfNotAlreadyDone( 'installStore' );
+               $this->updateStoreIfSchemaChanged();
+       }
+
+       protected function applyUpdateIfNotAlreadyDone( $functionName ) {
+               $updateName = 'wbquery-' . $functionName;
+
+               if ( !$this->updater->updateRowExists( $updateName ) ) {
+                       call_user_func( array( $this, $functionName ) );
+                       $this->updater->insertUpdateRow( $updateName );
+               }
+       }
+
+       protected function installStore() {
+               // TODO
+       }
+
+       protected function updateStoreIfSchemaChanged() {
+               // TODO
+       }
+
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4bade485ae35df389c46e15605f78ecd296ff155
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQuery
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to