Index: trunk/extensions/SwiftMedia/SwiftMedia.body.php |
— | — | @@ -54,10 +54,17 @@ |
55 | 55 | /**#@-*/ |
56 | 56 | |
57 | 57 | /** |
| 58 | + * @var SwiftRepo |
| 59 | + */ |
| 60 | + protected $repo; |
| 61 | + |
| 62 | + /** |
58 | 63 | * Create a LocalFile from a title |
59 | 64 | * Do not call this except from inside a repo class. |
60 | 65 | * |
61 | 66 | * Note: $unused param is only here to avoid an E_STRICT |
| 67 | + * |
| 68 | + * @return SwiftFile |
62 | 69 | */ |
63 | 70 | static function newFromTitle( $title, $repo, $unused = null ) { |
64 | 71 | if ( empty($title) ) { |
— | — | @@ -213,7 +220,6 @@ |
214 | 221 | throw new MWException( __METHOD__.': not implemented' ); |
215 | 222 | } |
216 | 223 | |
217 | | - |
218 | 224 | /** getHandler inherited */ |
219 | 225 | /** iconThumb inherited */ |
220 | 226 | /** getLastError inherited */ |
— | — | @@ -332,6 +338,8 @@ |
333 | 339 | * Given a connection and container name, return the container. |
334 | 340 | * We KNOW the container should exist, so puke if it doesn't. |
335 | 341 | * |
| 342 | + * @param $conn CF_Connection |
| 343 | + * |
336 | 344 | * @return CF_Container |
337 | 345 | */ |
338 | 346 | function get_container($conn, $cont) { |
— | — | @@ -370,7 +378,6 @@ |
371 | 379 | * Given a container and object name, delete the object. |
372 | 380 | * None of these error conditions are recoverable by the user, so we just dump |
373 | 381 | * an Internal Error on them. |
374 | | - * |
375 | 382 | */ |
376 | 383 | function swift_delete( $container, $rel ) { |
377 | 384 | try { |
— | — | @@ -401,7 +408,7 @@ |
402 | 409 | |
403 | 410 | // Validate each triplet |
404 | 411 | $status = $this->newGood(); |
405 | | - foreach ( $triplets as $i => $triplet ) { |
| 412 | + foreach ( $triplets as $triplet ) { |
406 | 413 | list( $srcPath, $dstZone, $dstRel ) = $triplet; |
407 | 414 | |
408 | 415 | if ( !$this->validateFilename( $dstRel ) ) { |
— | — | @@ -1192,16 +1199,16 @@ |
1193 | 1200 | /** |
1194 | 1201 | * Foreign file with an accessible MediaWiki database |
1195 | 1202 | * |
1196 | | - * @file |
1197 | 1203 | * @ingroup FileRepo |
1198 | 1204 | */ |
| 1205 | +class SwiftForeignDBFile extends SwiftFile { |
1199 | 1206 | |
1200 | | -/** |
1201 | | - * Foreign file with an accessible MediaWiki database |
1202 | | - * |
1203 | | - * @ingroup FileRepo |
1204 | | - */ |
1205 | | -class SwiftForeignDBFile extends SwiftFile { |
| 1207 | + /** |
| 1208 | + * @param $title |
| 1209 | + * @param $repo |
| 1210 | + * @param $unused |
| 1211 | + * @return SwiftForeignDBFile |
| 1212 | + */ |
1206 | 1213 | static function newFromTitle( $title, $repo, $unused = null ) { |
1207 | 1214 | return new self( $title, $repo ); |
1208 | 1215 | } |
— | — | @@ -1225,12 +1232,15 @@ |
1226 | 1233 | $watch = false, $timestamp = false ) { |
1227 | 1234 | $this->readOnlyError(); |
1228 | 1235 | } |
| 1236 | + |
1229 | 1237 | function restore( $versions = array(), $unsuppress = false ) { |
1230 | 1238 | $this->readOnlyError(); |
1231 | 1239 | } |
| 1240 | + |
1232 | 1241 | function delete( $reason, $suppress = false ) { |
1233 | 1242 | $this->readOnlyError(); |
1234 | 1243 | } |
| 1244 | + |
1235 | 1245 | function move( $target ) { |
1236 | 1246 | $this->readOnlyError(); |
1237 | 1247 | } |
— | — | @@ -1249,15 +1259,8 @@ |
1250 | 1260 | /** |
1251 | 1261 | * A foreign repository with an accessible MediaWiki database |
1252 | 1262 | * |
1253 | | - * @file |
1254 | 1263 | * @ingroup FileRepo |
1255 | 1264 | */ |
1256 | | - |
1257 | | -/** |
1258 | | - * A foreign repository with an accessible MediaWiki database |
1259 | | - * |
1260 | | - * @ingroup FileRepo |
1261 | | - */ |
1262 | 1265 | class SwiftForeignDBRepo extends SwiftRepo { |
1263 | 1266 | # Settings |
1264 | 1267 | var $dbType, $dbServer, $dbUser, $dbPassword, $dbName, $dbFlags, |
— | — | @@ -1280,6 +1283,9 @@ |
1281 | 1284 | $this->hasSharedCache = $info['hasSharedCache']; |
1282 | 1285 | } |
1283 | 1286 | |
| 1287 | + /** |
| 1288 | + * @return DatabaseBase |
| 1289 | + */ |
1284 | 1290 | function getMasterDB() { |
1285 | 1291 | wfDebug( __METHOD__.": {$this->dbServer}\n" ); |
1286 | 1292 | if ( !isset( $this->dbConn ) ) { |
— | — | @@ -1297,6 +1303,9 @@ |
1298 | 1304 | return $this->dbConn; |
1299 | 1305 | } |
1300 | 1306 | |
| 1307 | + /** |
| 1308 | + * @return DatabaseBase |
| 1309 | + */ |
1301 | 1310 | function getSlaveDB() { |
1302 | 1311 | return $this->getMasterDB(); |
1303 | 1312 | } |
— | — | @@ -1323,9 +1332,11 @@ |
1324 | 1333 | function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) { |
1325 | 1334 | throw new MWException( get_class($this) . ': write operations are not supported' ); |
1326 | 1335 | } |
| 1336 | + |
1327 | 1337 | function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) { |
1328 | 1338 | throw new MWException( get_class($this) . ': write operations are not supported' ); |
1329 | 1339 | } |
| 1340 | + |
1330 | 1341 | function deleteBatch( $sourceDestPairs ) { |
1331 | 1342 | throw new MWException( get_class($this) . ': write operations are not supported' ); |
1332 | 1343 | } |
— | — | @@ -1355,13 +1366,23 @@ |
1356 | 1367 | $this->hasSharedCache = $info['hasSharedCache']; |
1357 | 1368 | } |
1358 | 1369 | |
| 1370 | + /** |
| 1371 | + * @return DatabaseBase |
| 1372 | + */ |
1359 | 1373 | function getMasterDB() { |
1360 | 1374 | return wfGetDB( DB_MASTER, array(), $this->wiki ); |
1361 | 1375 | } |
1362 | 1376 | |
| 1377 | + /** |
| 1378 | + * @return DatabaseBase |
| 1379 | + */ |
1363 | 1380 | function getSlaveDB() { |
1364 | 1381 | return wfGetDB( DB_SLAVE, array(), $this->wiki ); |
1365 | 1382 | } |
| 1383 | + |
| 1384 | + /** |
| 1385 | + * @return bool |
| 1386 | + */ |
1366 | 1387 | function hasSharedCache() { |
1367 | 1388 | return $this->hasSharedCache; |
1368 | 1389 | } |
— | — | @@ -1384,9 +1405,11 @@ |
1385 | 1406 | function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) { |
1386 | 1407 | throw new MWException( get_class($this) . ': write operations are not supported' ); |
1387 | 1408 | } |
| 1409 | + |
1388 | 1410 | function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) { |
1389 | 1411 | throw new MWException( get_class($this) . ': write operations are not supported' ); |
1390 | 1412 | } |
| 1413 | + |
1391 | 1414 | function deleteBatch( $fileMap ) { |
1392 | 1415 | throw new MWException( get_class($this) . ': write operations are not supported' ); |
1393 | 1416 | } |