[MediaWiki-commits] [Gerrit] mediawiki...ConfirmEdit[master]: Move classes to own files

2017-12-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/398638 )

Change subject: Move classes to own files
..


Move classes to own files

Makes MediaWiki.Files.OneClassPerFile.MultipleFound pass

Change-Id: I88b5112d84d8983e67be1bca9f4039486bcefc6f
---
M .phpcs.xml
M extension.json
D includes/CaptchaStore.php
A includes/store/CaptchaCacheStore.php
A includes/store/CaptchaHashStore.php
A includes/store/CaptchaSessionStore.php
A includes/store/CaptchaStore.php
7 files changed, 154 insertions(+), 152 deletions(-)

Approvals:
  Florianschmidtwelzow: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.phpcs.xml b/.phpcs.xml
index a60b550..7e6cd14 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -5,7 +5,6 @@



-   



diff --git a/extension.json b/extension.json
index ce6ef61..2247452 100644
--- a/extension.json
+++ b/extension.json
@@ -52,10 +52,10 @@
"AutoloadClasses": {
"ConfirmEditHooks": "includes/ConfirmEditHooks.php",
"SimpleCaptcha": "SimpleCaptcha/Captcha.php",
-   "CaptchaStore": "includes/CaptchaStore.php",
-   "CaptchaSessionStore": "includes/CaptchaStore.php",
-   "CaptchaCacheStore": "includes/CaptchaStore.php",
-   "CaptchaHashStore": "includes/CaptchaStore.php",
+   "CaptchaStore": "includes/store/CaptchaStore.php",
+   "CaptchaSessionStore": "includes/store/CaptchaSessionStore.php",
+   "CaptchaCacheStore": "includes/store/CaptchaCacheStore.php",
+   "CaptchaHashStore": "includes/store/CaptchaHashStore.php",
"CaptchaTriggers": "includes/CaptchaTriggers.php",
"CaptchaSpecialPage": "includes/specials/SpecialCaptcha.php",
"CaptchaPreAuthenticationProvider": 
"includes/auth/CaptchaPreAuthenticationProvider.php",
diff --git a/includes/CaptchaStore.php b/includes/CaptchaStore.php
deleted file mode 100644
index 9eb5200..000
--- a/includes/CaptchaStore.php
+++ /dev/null
@@ -1,147 +0,0 @@
-persist();
-   }
-
-   function store( $index, $info ) {
-   SessionManager::getGlobalSession()->set( 'captcha' . $index, 
$info );
-   }
-
-   function retrieve( $index ) {
-   return SessionManager::getGlobalSession()->get( 'captcha' . 
$index, false );
-   }
-
-   function clear( $index ) {
-   SessionManager::getGlobalSession()->remove( 'captcha' . $index 
);
-   }
-
-   function cookiesNeeded() {
-   return true;
-   }
-}
-
-class CaptchaCacheStore extends CaptchaStore {
-   function store( $index, $info ) {
-   global $wgCaptchaSessionExpiration;
-
-   ObjectCache::getMainStashInstance()->set(
-   wfMemcKey( 'captcha', $index ),
-   $info,
-   $wgCaptchaSessionExpiration
-   );
-   }
-
-   function retrieve( $index ) {
-   $info = ObjectCache::getMainStashInstance()->get( wfMemcKey( 
'captcha', $index ) );
-   if ( $info ) {
-   return $info;
-   } else {
-   return false;
-   }
-   }
-
-   function clear( $index ) {
-   ObjectCache::getMainStashInstance()->delete( wfMemcKey( 
'captcha', $index ) );
-   }
-
-   function cookiesNeeded() {
-   return false;
-   }
-}
-
-class CaptchaHashStore extends CaptchaStore {
-   protected $data = [];
-
-   public function store( $index, $info ) {
-   $this->data[$index] = $info;
-   }
-
-   public function retrieve( $index ) {
-   if ( array_key_exists( $index, $this->data ) ) {
-   return $this->data[$index];
-   }
-   return false;
-   }
-
-   public function clear( $index ) {
-   unset( $this->data[$index] );
-   }
-
-   public function cookiesNeeded() {
-   return false;
-   }
-
-   public function clearAll() {
-   $this->data = [];
-   }
-}
diff --git a/includes/store/CaptchaCacheStore.php 
b/includes/store/CaptchaCacheStore.php
new file mode 100644
index 000..d6661b3
--- /dev/null
+++ b/includes/store/CaptchaCacheStore.php
@@ -0,0 +1,30 @@
+set(
+   wfMemcKey( 'captcha', $index ),
+   $info,
+   $wgCaptchaSessionExpiration
+   );
+   }
+
+   function retrieve( $index ) {
+   $info = ObjectCache::getMainStashInstance()->get( wfMemcKey( 
'captcha', $index ) );
+   if ( $info ) {
+   return $info;
+   } else {
+   return false;
+   }
+   }

[MediaWiki-commits] [Gerrit] mediawiki...ConfirmEdit[master]: Move classes to own files

2017-12-16 Thread Umherirrender (Code Review)
Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398638 )

Change subject: Move classes to own files
..

Move classes to own files

Makes MediaWiki.Files.OneClassPerFile.MultipleFound pass

Change-Id: I88b5112d84d8983e67be1bca9f4039486bcefc6f
---
M .phpcs.xml
M extension.json
D includes/CaptchaStore.php
A includes/store/CaptchaCacheStore.php
A includes/store/CaptchaHashStore.php
A includes/store/CaptchaSessionStore.php
A includes/store/CaptchaStore.php
7 files changed, 154 insertions(+), 152 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit 
refs/changes/38/398638/1

diff --git a/.phpcs.xml b/.phpcs.xml
index a60b550..7e6cd14 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -5,7 +5,6 @@



-   



diff --git a/extension.json b/extension.json
index ce6ef61..2247452 100644
--- a/extension.json
+++ b/extension.json
@@ -52,10 +52,10 @@
"AutoloadClasses": {
"ConfirmEditHooks": "includes/ConfirmEditHooks.php",
"SimpleCaptcha": "SimpleCaptcha/Captcha.php",
-   "CaptchaStore": "includes/CaptchaStore.php",
-   "CaptchaSessionStore": "includes/CaptchaStore.php",
-   "CaptchaCacheStore": "includes/CaptchaStore.php",
-   "CaptchaHashStore": "includes/CaptchaStore.php",
+   "CaptchaStore": "includes/store/CaptchaStore.php",
+   "CaptchaSessionStore": "includes/store/CaptchaSessionStore.php",
+   "CaptchaCacheStore": "includes/store/CaptchaCacheStore.php",
+   "CaptchaHashStore": "includes/store/CaptchaHashStore.php",
"CaptchaTriggers": "includes/CaptchaTriggers.php",
"CaptchaSpecialPage": "includes/specials/SpecialCaptcha.php",
"CaptchaPreAuthenticationProvider": 
"includes/auth/CaptchaPreAuthenticationProvider.php",
diff --git a/includes/CaptchaStore.php b/includes/CaptchaStore.php
deleted file mode 100644
index 9eb5200..000
--- a/includes/CaptchaStore.php
+++ /dev/null
@@ -1,147 +0,0 @@
-persist();
-   }
-
-   function store( $index, $info ) {
-   SessionManager::getGlobalSession()->set( 'captcha' . $index, 
$info );
-   }
-
-   function retrieve( $index ) {
-   return SessionManager::getGlobalSession()->get( 'captcha' . 
$index, false );
-   }
-
-   function clear( $index ) {
-   SessionManager::getGlobalSession()->remove( 'captcha' . $index 
);
-   }
-
-   function cookiesNeeded() {
-   return true;
-   }
-}
-
-class CaptchaCacheStore extends CaptchaStore {
-   function store( $index, $info ) {
-   global $wgCaptchaSessionExpiration;
-
-   ObjectCache::getMainStashInstance()->set(
-   wfMemcKey( 'captcha', $index ),
-   $info,
-   $wgCaptchaSessionExpiration
-   );
-   }
-
-   function retrieve( $index ) {
-   $info = ObjectCache::getMainStashInstance()->get( wfMemcKey( 
'captcha', $index ) );
-   if ( $info ) {
-   return $info;
-   } else {
-   return false;
-   }
-   }
-
-   function clear( $index ) {
-   ObjectCache::getMainStashInstance()->delete( wfMemcKey( 
'captcha', $index ) );
-   }
-
-   function cookiesNeeded() {
-   return false;
-   }
-}
-
-class CaptchaHashStore extends CaptchaStore {
-   protected $data = [];
-
-   public function store( $index, $info ) {
-   $this->data[$index] = $info;
-   }
-
-   public function retrieve( $index ) {
-   if ( array_key_exists( $index, $this->data ) ) {
-   return $this->data[$index];
-   }
-   return false;
-   }
-
-   public function clear( $index ) {
-   unset( $this->data[$index] );
-   }
-
-   public function cookiesNeeded() {
-   return false;
-   }
-
-   public function clearAll() {
-   $this->data = [];
-   }
-}
diff --git a/includes/store/CaptchaCacheStore.php 
b/includes/store/CaptchaCacheStore.php
new file mode 100644
index 000..d6661b3
--- /dev/null
+++ b/includes/store/CaptchaCacheStore.php
@@ -0,0 +1,30 @@
+set(
+   wfMemcKey( 'captcha', $index ),
+   $info,
+   $wgCaptchaSessionExpiration
+   );
+   }
+
+   function retrieve( $index ) {
+   $info = ObjectCache::getMainStashInstance()->get( wfMemcKey( 
'captcha', $index ) );
+   if ( $info ) {
+   return $info;
+   } else {
+   return false;
+   }