aboutsummaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2012-05-23 11:03:19 -0700
committerAaron <aschulz@wikimedia.org>2012-05-24 16:29:32 -0700
commitd30c5147965a0b9ee3512c5a133d7c9773593b83 (patch)
tree669ae020062337ee9de11e045f28c1d37766f454 /includes
parentf27ff698fb1c6442f20dc08344821b08d52199d5 (diff)
downloadmediawikicore-d30c5147965a0b9ee3512c5a133d7c9773593b83.tar.gz
mediawikicore-d30c5147965a0b9ee3512c5a133d7c9773593b83.zip
[FileBackend] Gave doQuickOperations() some wrapper methods just like doOperations().
Change-Id: I0186a60bddcb26f008f6a6512eb5190a08142802
Diffstat (limited to 'includes')
-rw-r--r--includes/filerepo/backend/FileBackend.php86
-rw-r--r--includes/filerepo/backend/FileOp.php2
2 files changed, 86 insertions, 2 deletions
diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php
index 81fbcedda686..f0e123d7d23a 100644
--- a/includes/filerepo/backend/FileBackend.php
+++ b/includes/filerepo/backend/FileBackend.php
@@ -401,6 +401,7 @@ abstract class FileBackend {
*
* @param $ops Array Set of operations to execute
* @return Status
+ * @since 1.20
*/
final public function doQuickOperations( array $ops ) {
if ( $this->isReadOnly() ) {
@@ -414,10 +415,95 @@ abstract class FileBackend {
/**
* @see FileBackend::doQuickOperations()
+ * @since 1.20
*/
abstract protected function doQuickOperationsInternal( array $ops );
/**
+ * Same as doQuickOperations() except it takes a single operation.
+ * If you are doing a batch of operations, then use that function instead.
+ *
+ * @see FileBackend::doQuickOperations()
+ *
+ * @param $op Array Operation
+ * @return Status
+ * @since 1.20
+ */
+ final public function doQuickOperation( array $op ) {
+ return $this->doQuickOperations( array( $op ) );
+ }
+
+ /**
+ * Performs a single quick create operation.
+ * This sets $params['op'] to 'create' and passes it to doQuickOperation().
+ *
+ * @see FileBackend::doQuickOperation()
+ *
+ * @param $params Array Operation parameters
+ * @return Status
+ * @since 1.20
+ */
+ final public function quickCreate( array $params ) {
+ return $this->doQuickOperation( array( 'op' => 'create' ) + $params );
+ }
+
+ /**
+ * Performs a single quick store operation.
+ * This sets $params['op'] to 'store' and passes it to doQuickOperation().
+ *
+ * @see FileBackend::doQuickOperation()
+ *
+ * @param $params Array Operation parameters
+ * @return Status
+ * @since 1.20
+ */
+ final public function quickStore( array $params ) {
+ return $this->doQuickOperation( array( 'op' => 'store' ) + $params );
+ }
+
+ /**
+ * Performs a single quick copy operation.
+ * This sets $params['op'] to 'copy' and passes it to doQuickOperation().
+ *
+ * @see FileBackend::doQuickOperation()
+ *
+ * @param $params Array Operation parameters
+ * @return Status
+ * @since 1.20
+ */
+ final public function quickCopy( array $params ) {
+ return $this->doQuickOperation( array( 'op' => 'copy' ) + $params );
+ }
+
+ /**
+ * Performs a single quick move operation.
+ * This sets $params['op'] to 'move' and passes it to doQuickOperation().
+ *
+ * @see FileBackend::doQuickOperation()
+ *
+ * @param $params Array Operation parameters
+ * @return Status
+ * @since 1.20
+ */
+ final public function quickMove( array $params ) {
+ return $this->doQuickOperation( array( 'op' => 'move' ) + $params );
+ }
+
+ /**
+ * Performs a single quick delete operation.
+ * This sets $params['op'] to 'delete' and passes it to doQuickOperation().
+ *
+ * @see FileBackend::doQuickOperation()
+ *
+ * @param $params Array Operation parameters
+ * @return Status
+ * @since 1.20
+ */
+ final public function quickDelete( array $params ) {
+ return $this->doQuickOperation( array( 'op' => 'delete' ) + $params );
+ }
+
+ /**
* Concatenate a list of storage files into a single file system file.
* The target path should refer to a file that is already locked or
* otherwise safe from modification from other processes. Normally,
diff --git a/includes/filerepo/backend/FileOp.php b/includes/filerepo/backend/FileOp.php
index d9fbafd9b155..ac2496dc5e5a 100644
--- a/includes/filerepo/backend/FileOp.php
+++ b/includes/filerepo/backend/FileOp.php
@@ -438,7 +438,6 @@ abstract class FileOp {
* overwriteSame : override any existing file at destination
*/
class StoreFileOp extends FileOp {
-
/**
* @return array
*/
@@ -579,7 +578,6 @@ class CreateFileOp extends FileOp {
* overwriteSame : override any existing file at destination
*/
class CopyFileOp extends FileOp {
-
/**
* @return array
*/