dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "TableDiffFormatter: Don't repeatedly call array_shift()"
[lhc/web/wiklou.git]
/
includes
/
upload
/
UploadStash.php
diff --git
a/includes/upload/UploadStash.php
b/includes/upload/UploadStash.php
index
e241383
..
c171ded
100644
(file)
--- a/
includes/upload/UploadStash.php
+++ b/
includes/upload/UploadStash.php
@@
-65,13
+65,13
@@
class UploadStash {
public $repo;
// array of initialized repo objects
public $repo;
// array of initialized repo objects
- protected $files =
array()
;
+ protected $files =
[]
;
// cache of the file metadata that's stored in the database
// cache of the file metadata that's stored in the database
- protected $fileMetadata =
array()
;
+ protected $fileMetadata =
[]
;
// fileprops cache
// fileprops cache
- protected $fileProps =
array()
;
+ protected $fileProps =
[]
;
// current user
protected $user, $userId, $isLoggedIn;
// current user
protected $user, $userId, $isLoggedIn;
@@
-226,8
+226,8
@@
class UploadStash {
// see: http://www.jwz.org/doc/mid.html
list( $usec, $sec ) = explode( ' ', microtime() );
$usec = substr( $usec, 2 );
// see: http://www.jwz.org/doc/mid.html
list( $usec, $sec ) = explode( ' ', microtime() );
$usec = substr( $usec, 2 );
- $key =
wfBaseC
onvert( $sec . $usec, 10, 36 ) . '.' .
-
wfBaseC
onvert( mt_rand(), 10, 36 ) . '.' .
+ $key =
Wikimedia\base_c
onvert( $sec . $usec, 10, 36 ) . '.' .
+
Wikimedia\base_c
onvert( mt_rand(), 10, 36 ) . '.' .
$this->userId . '.' .
$extension;
$this->userId . '.' .
$extension;
@@
-257,7
+257,7
@@
class UploadStash {
$error = $storeStatus->getWarningsArray();
$error = reset( $error );
if ( !count( $error ) ) {
$error = $storeStatus->getWarningsArray();
$error = reset( $error );
if ( !count( $error ) ) {
- $error =
array( 'unknown', 'no error recorded' )
;
+ $error =
[ 'unknown', 'no error recorded' ]
;
}
}
// At this point, $error should contain the single "most important"
}
}
// At this point, $error should contain the single "most important"
@@
-276,7
+276,7
@@
class UploadStash {
// insert the file metadata into the db.
wfDebug( __METHOD__ . " inserting $stashPath under $key\n" );
// insert the file metadata into the db.
wfDebug( __METHOD__ . " inserting $stashPath under $key\n" );
- $dbw = $this->repo->getMasterD
b
();
+ $dbw = $this->repo->getMasterD
B
();
$serializedFileProps = serialize( $fileProps );
if ( strlen( $serializedFileProps ) > self::MAX_US_PROPS_SIZE ) {
$serializedFileProps = serialize( $fileProps );
if ( strlen( $serializedFileProps ) > self::MAX_US_PROPS_SIZE ) {
@@
-287,7
+287,7
@@
class UploadStash {
$serializedFileProps = serialize( $fileProps );
}
$serializedFileProps = serialize( $fileProps );
}
- $this->fileMetadata[$key] =
array(
+ $this->fileMetadata[$key] =
[
'us_id' => $dbw->nextSequenceValue( 'uploadstash_us_id_seq' ),
'us_user' => $this->userId,
'us_key' => $key,
'us_id' => $dbw->nextSequenceValue( 'uploadstash_us_id_seq' ),
'us_user' => $this->userId,
'us_key' => $key,
@@
-304,7
+304,7
@@
class UploadStash {
'us_source_type' => $sourceType,
'us_timestamp' => $dbw->timestamp(),
'us_status' => 'finished'
'us_source_type' => $sourceType,
'us_timestamp' => $dbw->timestamp(),
'us_status' => 'finished'
-
)
;
+
]
;
$dbw->insert(
'uploadstash',
$dbw->insert(
'uploadstash',
@@
-336,16
+336,16
@@
class UploadStash {
}
wfDebug( __METHOD__ . ' clearing all rows for user ' . $this->userId . "\n" );
}
wfDebug( __METHOD__ . ' clearing all rows for user ' . $this->userId . "\n" );
- $dbw = $this->repo->getMasterD
b
();
+ $dbw = $this->repo->getMasterD
B
();
$dbw->delete(
'uploadstash',
$dbw->delete(
'uploadstash',
-
array( 'us_user' => $this->userId )
,
+
[ 'us_user' => $this->userId ]
,
__METHOD__
);
# destroy objects.
__METHOD__
);
# destroy objects.
- $this->files =
array()
;
- $this->fileMetadata =
array()
;
+ $this->files =
[]
;
+ $this->fileMetadata =
[]
;
return true;
}
return true;
}
@@
-364,14
+364,14
@@
class UploadStash {
. ' No user is logged in, files must belong to users' );
}
. ' No user is logged in, files must belong to users' );
}
- $dbw = $this->repo->getMasterD
b
();
+ $dbw = $this->repo->getMasterD
B
();
// this is a cheap query. it runs on the master so that this function
// still works when there's lag. It won't be called all that often.
$row = $dbw->selectRow(
'uploadstash',
'us_user',
// this is a cheap query. it runs on the master so that this function
// still works when there's lag. It won't be called all that often.
$row = $dbw->selectRow(
'uploadstash',
'us_user',
-
array( 'us_key' => $key )
,
+
[ 'us_key' => $key ]
,
__METHOD__
);
__METHOD__
);
@@
-399,11
+399,11
@@
class UploadStash {
// Ensure we have the UploadStashFile loaded for this key
$this->getFile( $key, true );
// Ensure we have the UploadStashFile loaded for this key
$this->getFile( $key, true );
- $dbw = $this->repo->getMasterD
b
();
+ $dbw = $this->repo->getMasterD
B
();
$dbw->delete(
'uploadstash',
$dbw->delete(
'uploadstash',
-
array( 'us_key' => $key )
,
+
[ 'us_key' => $key ]
,
__METHOD__
);
__METHOD__
);
@@
-430,11
+430,11
@@
class UploadStash {
. ' No user is logged in, files must belong to users' );
}
. ' No user is logged in, files must belong to users' );
}
- $dbr = $this->repo->getSlaveD
b
();
+ $dbr = $this->repo->getSlaveD
B
();
$res = $dbr->select(
'uploadstash',
'us_key',
$res = $dbr->select(
'uploadstash',
'us_key',
-
array( 'us_user' => $this->userId )
,
+
[ 'us_user' => $this->userId ]
,
__METHOD__
);
__METHOD__
);
@@
-444,7
+444,7
@@
class UploadStash {
}
// finish the read before starting writes.
}
// finish the read before starting writes.
- $keys =
array()
;
+ $keys =
[]
;
foreach ( $res as $row ) {
array_push( $keys, $row->us_key );
}
foreach ( $res as $row ) {
array_push( $keys, $row->us_key );
}
@@
-507,15
+507,15
@@
class UploadStash {
$dbr = null;
if ( $readFromDB === DB_MASTER ) {
// sometimes reading from the master is necessary, if there's replication lag.
$dbr = null;
if ( $readFromDB === DB_MASTER ) {
// sometimes reading from the master is necessary, if there's replication lag.
- $dbr = $this->repo->getMasterD
b
();
+ $dbr = $this->repo->getMasterD
B
();
} else {
} else {
- $dbr = $this->repo->getSlaveD
b
();
+ $dbr = $this->repo->getSlaveD
B
();
}
$row = $dbr->selectRow(
'uploadstash',
'*',
}
$row = $dbr->selectRow(
'uploadstash',
'*',
-
array( 'us_key' => $key )
,
+
[ 'us_key' => $key ]
,
__METHOD__
);
__METHOD__
);