/**
* Helper function -- remove files and associated articles by Title
- * @param $title Title: title to be removed
+ *
+ * @param Title $title title to be removed
+ *
+ * @return bool
*/
public function deleteFileByTitle( $title ) {
if ( $title->exists() ) {
$noOldArchive = ""; // yes this really needs to be set this way
$comment = "removing for test";
$restrictDeletedVersions = false;
- $status = FileDeleteForm::doDelete( $title, $file, $noOldArchive, $comment, $restrictDeletedVersions );
+ $status = FileDeleteForm::doDelete(
+ $title,
+ $file,
+ $noOldArchive,
+ $comment,
+ $restrictDeletedVersions
+ );
+
if ( !$status->isGood() ) {
return false;
}
+
$page = WikiPage::factory( $title );
$page->doDeleteArticle( "removing for test" );
/**
* Helper function -- remove files and associated articles with a particular filename
- * @param $fileName String: filename to be removed
+ *
+ * @param string $fileName filename to be removed
+ *
+ * @return bool
*/
public function deleteFileByFileName( $fileName ) {
return $this->deleteFileByTitle( Title::newFromText( $fileName, NS_FILE ) );
}
/**
- * Helper function -- given a file on the filesystem, find matching content in the db (and associated articles) and remove them.
- * @param $filePath String: path to file on the filesystem
+ * Helper function -- given a file on the filesystem, find matching
+ * content in the db (and associated articles) and remove them.
+ *
+ * @param string $filePath path to file on the filesystem
+ *
+ * @return bool
*/
public function deleteFileByContent( $filePath ) {
$hash = FSFile::getSha1Base36FromPath( $filePath );
/**
* Fake an upload by dumping the file into temp space, and adding info to $_FILES.
* (This is what PHP would normally do).
- * @param $fieldName String: name this would have in the upload form
- * @param $fileName String: name to title this
- * @param $type String: mime type
- * @param $filePath String: path where to find file contents
+ *
+ * @param string $fieldName name this would have in the upload form
+ * @param string $fileName name to title this
+ * @param string $type mime type
+ * @param string $filePath path where to find file contents
+ *
+ * @throws Exception
+ * @return bool
*/
function fakeUploadFile( $fieldName, $fileName, $type, $filePath ) {
$tmpName = tempnam( wfTempDir(), "" );