本文整理汇总了PHP中ArticleFileManager::deleteArticleTree方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleFileManager::deleteArticleTree方法的具体用法?PHP ArticleFileManager::deleteArticleTree怎么用?PHP ArticleFileManager::deleteArticleTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleFileManager
的用法示例。
在下文中一共展示了ArticleFileManager::deleteArticleTree方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNativeDoiImport
public function testNativeDoiImport()
{
$testfile = 'tests/functional/plugins/importexport/native/testissue.xml';
$args = array('import', $testfile, 'test', 'admin');
$result = $this->executeCli('NativeImportExportPlugin', $args);
self::assertRegExp('/##plugins.importexport.native.import.success.description##/', $result);
$daos = array('Issue' => 'IssueDAO', 'PublishedArticle' => 'PublishedArticleDAO', 'Galley' => 'ArticleGalleyDAO', 'SuppFile' => 'SuppFileDAO');
$articelId = null;
foreach ($daos as $objectType => $daoName) {
$dao = DAORegistry::getDAO($daoName);
$pubObject = call_user_func(array($dao, "get{$objectType}ByPubId"), 'doi', $this->expectedDois[$objectType]);
self::assertNotNull($pubObject, "Error while testing {$objectType}: object or DOI has not been imported.");
$pubObjectByURN = call_user_func(array($dao, "get{$objectType}ByPubId"), 'other::urn', $this->expectedURNs[$objectType]);
self::assertNotNull($pubObjectByURN, "Error while testing {$objectType}: object or URN has not been imported.");
if ($objectType == 'PublishedArticle') {
$articelId = $pubObject->getId();
}
}
// Trying to import the same file again should lead to an error.
$args = array('import', $testfile, 'test', 'admin');
$result = $this->executeCli('NativeImportExportPlugin', $args);
self::assertRegExp('/##plugins.importexport.native.import.error.duplicatePubId##/', $result);
// Delete inserted article files from the filesystem.
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articelId);
$articleFileManager->deleteArticleTree();
}
示例2: deleteSubmission
/**
* Delete a submission.
*/
function deleteSubmission($args)
{
$articleId = isset($args[0]) ? (int) $args[0] : 0;
$this->validate($articleId);
$authorSubmission =& $this->submission;
$this->setupTemplate(true);
// If the submission is incomplete, allow the author to delete it.
if ($authorSubmission->getSubmissionProgress() != 0) {
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteArticleTree();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$articleDao->deleteArticleById($args[0]);
}
Request::redirect(null, null, 'index');
}
示例3: deleteSubmission
/**
* Delete a submission.
* @param $args array
* @param $request PKPRequest
*/
function deleteSubmission($args, $request)
{
$articleId = (int) array_shift($args);
$this->validate($request, $articleId);
$authorSubmission =& $this->submission;
$this->setupTemplate($request, true);
// If the submission is incomplete, allow the author to delete it.
if ($authorSubmission->getSubmissionProgress() != 0) {
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteArticleTree();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$articleDao->deleteArticleById($articleId);
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleDeleted($articleId);
$articleSearchIndex->articleChangesFinished();
}
$request->redirect(null, null, 'index');
}
示例4: execute
/**
* Delete submission data and associated files
*/
function execute()
{
$articleDao =& DAORegistry::getDAO('ArticleDAO');
foreach ($this->parameters as $articleId) {
$article =& $articleDao->getArticle($articleId);
if (isset($article)) {
// remove files first, to prevent orphans
$articleFileManager = new ArticleFileManager($articleId);
if (!file_exists($articleFileManager->filesDir)) {
printf("Warning: no files found for submission {$articleId}.\n");
} else {
if (!is_writable($articleFileManager->filesDir)) {
printf("Error: Skipping submission {$articleId}. Can't delete files in " . $articleFileManager->filesDir . "\n");
continue;
} else {
$articleFileManager->deleteArticleTree();
}
}
$articleDao->deleteArticleById($articleId);
continue;
}
printf("Error: Skipping {$articleId}. Unknown submission.\n");
}
}
示例5: deleteSubmission
/**
* Delete a submission.
*/
function deleteSubmission($args, $request)
{
$articleId = (int) array_shift($args);
$this->validate($articleId);
parent::setupTemplate(true);
$journal =& $request->getJournal();
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $articleDao->getArticle($articleId);
$status = $article->getStatus();
if ($article->getJournalId() == $journal->getId() && ($status == STATUS_DECLINED || $status == STATUS_ARCHIVED)) {
// Delete article files
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articleId);
$articleFileManager->deleteArticleTree();
// Delete article database entries
$articleDao->deleteArticleById($articleId);
}
$request->redirect(null, null, 'submissions', 'submissionsArchives');
}