[MediaWiki-commits] [Gerrit] TalkpageManager method renames - change (mediawiki...Flow)

2016-03-04 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: TalkpageManager method renames
..


TalkpageManager method renames

I thought some 2 method names were slightly confusing:

* checkIfCreationTechnicallyAllowed could be interpreted like "we'll
  check if you have permissions in theory (which may still be
  overruled in practice)" - "technically" could be considered the
  opposite of "practically", but here it means "system limitations"
* checkedAllowCreation could be interpreted like "this IS checked, so
  go ahead and do it" instead of "this WILL BE checked"

I also removed one of BoardMover's constructor args, now we no longer
need it.

Change-Id: I0d8cfb322ab88fbee09c5599c6d538b1db14acb8
---
M Hooks.php
M container.php
M includes/Api/ApiFlow.php
M includes/BoardMover.php
M includes/Dump/Importer.php
M includes/Import/Importer.php
M includes/Import/OptInController.php
M includes/Specials/SpecialEnableFlow.php
M includes/SubmissionHandler.php
M includes/TalkpageManager.php
M maintenance/FlowUpdateWorkflowPageId.php
M tests/phpunit/HookTest.php
M tests/phpunit/PostRevisionTestCase.php
M tests/phpunit/TalkpageManagerTest.php
14 files changed, 53 insertions(+), 56 deletions(-)

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



diff --git a/Hooks.php b/Hooks.php
index 6edbeda..de25558 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -1275,7 +1275,7 @@
}
 
$occupationController = self::getOccupationController();
-   $flowStatus = 
$occupationController->checkIfCreationTechnicallyAllowed( $newTitle, 
/*mustNotExist*/ true );
+   $flowStatus = $occupationController->checkIfCreationIsPossible( 
$newTitle, /*mustNotExist*/ true );
$status->merge( $flowStatus );
 
return true;
@@ -1618,7 +1618,7 @@
 
/**
 * @param Title $title Title corresponding to the article restored
-* @param bool $create Whether or not the restoration caused the page 
to be created (i.e. it didn't exist before).
+* @param bool $created Whether or not the restoration caused the page 
to be created (i.e. it didn't exist before).
 * @param string $comment The comment associated with the undeletion.
 * @param int $oldPageId ID of page previously deleted (from archive 
table)
 * @return bool
@@ -1652,6 +1652,9 @@
$bogusTitle = clone $newTitle;
$bogusTitle->resetArticleID( $oldTitle->getArticleID() 
);
 
+   // This is only safe because we have called
+   // checkIfCreationIsPossible and (usually) 
checkIfUserHasPermission.
+   Container::get( 'occupation_controller' 
)->forceAllowCreation( $bogusTitle );
// complete hack to make sure that when the page is 
saved to new
// location and rendered it doesn't throw an error 
about the wrong title
Container::get( 'factory.loader.workflow' 
)->pageMoveInProgress();
diff --git a/container.php b/container.php
index cc7202a..21aeaba 100644
--- a/container.php
+++ b/container.php
@@ -1298,8 +1298,7 @@
$c['db.factory'],
$c['memcache.local_buffered'],
$c['storage'],
-   $c['occupation_controller']->getTalkpageManager(),
-   $c['occupation_controller']
+   $c['occupation_controller']->getTalkpageManager()
);
 };
 
diff --git a/includes/Api/ApiFlow.php b/includes/Api/ApiFlow.php
index 48401f1..3205350 100644
--- a/includes/Api/ApiFlow.php
+++ b/includes/Api/ApiFlow.php
@@ -123,9 +123,9 @@
// Just check for permissions, nothing else to do. The 
Flow board
// will be put in place right before the rest of the 
data is stored
// (in SubmissionHandler::commit), after everything's 
been validated.
-   $status = $controller->checkedAllowCreation( $page, 
$this->getUser() );
+   $status = $controller->safeAllowCreation( $page, 
$this->getUser() );
if ( !$status->isGood() ) {
-   $this->dieUsage( "Page provided does not have 
Flow enabled and checkedAllowCreation failed with: " . 
$status->getMessage()->parse(), 'invalid-page' );
+   $this->dieUsage( "Page provided does not have 
Flow enabled and safeAllowCreation failed with: " . 
$status->getMessage()->parse(), 'invalid-page' );
}
}
 
diff --git a/includes/BoardMover.php b/includes/BoardMover.php
index 8abccc5..a8a50c8 100644
--- a/includes/BoardMover.php
+++ b/includes/BoardMover.php
@@ -11,9 +11,6 @@
 use Title;
 use User;
 
-/**
- *
- */
 class BoardMover {
/**
 * @var DbFactory
@@ -31,21 +28,15 @@

[MediaWiki-commits] [Gerrit] TalkpageManager method renames - change (mediawiki...Flow)

2016-02-29 Thread Matthias Mullie (Code Review)
Matthias Mullie has uploaded a new change for review.

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

Change subject: TalkpageManager method renames
..

TalkpageManager method renames

I thought some 2 method names were slightly confusing:

* checkIfCreationTechnicallyAllowed could be interpreted like "we'll
  check if you have permissions in theory (which may still be
  overruled in practice)" - "technically" could be considered the
  opposite of "practically", but here it means "system limitations"
* checkedAllowCreation could be interpreted like "this IS checked, so
  go ahead and do it" instead of "this WILL BE checked"

I also removed one of BoardMover's constructor args, now we no longer
need it.

Change-Id: I0d8cfb322ab88fbee09c5599c6d538b1db14acb8
---
M Hooks.php
M container.php
M includes/Api/ApiFlow.php
M includes/BoardMover.php
M includes/Dump/Importer.php
M includes/Import/Importer.php
M includes/Import/OptInController.php
M includes/Specials/SpecialEnableFlow.php
M includes/SubmissionHandler.php
M includes/TalkpageManager.php
M maintenance/FlowUpdateWorkflowPageId.php
M tests/phpunit/HookTest.php
M tests/phpunit/PostRevisionTestCase.php
M tests/phpunit/TalkpageManagerTest.php
14 files changed, 52 insertions(+), 54 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/78/273878/1

diff --git a/Hooks.php b/Hooks.php
index 6edbeda..903a6e1 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -1275,7 +1275,7 @@
}
 
$occupationController = self::getOccupationController();
-   $flowStatus = 
$occupationController->checkIfCreationTechnicallyAllowed( $newTitle, 
/*mustNotExist*/ true );
+   $flowStatus = $occupationController->checkIfCreationIsPossible( 
$newTitle, /*mustNotExist*/ true );
$status->merge( $flowStatus );
 
return true;
@@ -1618,7 +1618,7 @@
 
/**
 * @param Title $title Title corresponding to the article restored
-* @param bool $create Whether or not the restoration caused the page 
to be created (i.e. it didn't exist before).
+* @param bool $created Whether or not the restoration caused the page 
to be created (i.e. it didn't exist before).
 * @param string $comment The comment associated with the undeletion.
 * @param int $oldPageId ID of page previously deleted (from archive 
table)
 * @return bool
diff --git a/container.php b/container.php
index cc7202a..2fc99a3 100644
--- a/container.php
+++ b/container.php
@@ -1298,7 +1298,6 @@
$c['db.factory'],
$c['memcache.local_buffered'],
$c['storage'],
-   $c['occupation_controller']->getTalkpageManager(),
$c['occupation_controller']
);
 };
diff --git a/includes/Api/ApiFlow.php b/includes/Api/ApiFlow.php
index 48401f1..3205350 100644
--- a/includes/Api/ApiFlow.php
+++ b/includes/Api/ApiFlow.php
@@ -123,9 +123,9 @@
// Just check for permissions, nothing else to do. The 
Flow board
// will be put in place right before the rest of the 
data is stored
// (in SubmissionHandler::commit), after everything's 
been validated.
-   $status = $controller->checkedAllowCreation( $page, 
$this->getUser() );
+   $status = $controller->safeAllowCreation( $page, 
$this->getUser() );
if ( !$status->isGood() ) {
-   $this->dieUsage( "Page provided does not have 
Flow enabled and checkedAllowCreation failed with: " . 
$status->getMessage()->parse(), 'invalid-page' );
+   $this->dieUsage( "Page provided does not have 
Flow enabled and safeAllowCreation failed with: " . 
$status->getMessage()->parse(), 'invalid-page' );
}
}
 
diff --git a/includes/BoardMover.php b/includes/BoardMover.php
index 8abccc5..0a30f8f 100644
--- a/includes/BoardMover.php
+++ b/includes/BoardMover.php
@@ -9,11 +9,7 @@
 use Flow\Model\Header;
 use Flow\Model\Workflow;
 use Title;
-use User;
 
-/**
- *
- */
 class BoardMover {
/**
 * @var DbFactory
@@ -26,12 +22,7 @@
protected $storage;
 
/**
-* @var User
-*/
-   protected $nullEditUser;
-
-   /**
-* @var TalkpageManager
+* @var OccupationController
 */
protected $talkpageManager;
 
@@ -40,11 +31,10 @@
 */
protected $dbw;
 
-   public function __construct( DbFactory $dbFactory, BufferedCache 
$cache, ManagerGroup $storage, User $nullEditUser, TalkpageManager 
$talkpageManager ) {
+   public function __construct( DbFactory $dbFactory, BufferedCache 
$cache, ManagerGroup $storage, OccupationController $talkpageManager ) {
$this->dbFactory = $dbFactory;
$this