本文整理汇总了PHP中ArticleSearchIndex::articleFileDeleted方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleSearchIndex::articleFileDeleted方法的具体用法?PHP ArticleSearchIndex::articleFileDeleted怎么用?PHP ArticleSearchIndex::articleFileDeleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleSearchIndex
的用法示例。
在下文中一共展示了ArticleSearchIndex::articleFileDeleted方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Save the metadata and store the catalog data for this published
* monograph.
*/
function execute($request)
{
parent::execute($request);
$submission = $this->getSubmission();
$context = $request->getContext();
$waivePublicationFee = $request->getUserVar('waivePublicationFee') ? true : false;
if ($waivePublicationFee) {
$markAsPaid = $request->getUserVar('markAsPaid');
import('classes.payment.ojs.OJSPaymentManager');
$paymentManager = new OJSPaymentManager($request);
$user = $request->getUser();
$queuedPayment =& $paymentManager->createQueuedPayment($context->getId(), PAYMENT_TYPE_PUBLICATION, $markAsPaid ? $submission->getUserId() : $user->getId(), $submission->getId(), $markAsPaid ? $context->getSetting('publicationFee') : 0, $markAsPaid ? $context->getSetting('currency') : '');
$queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
// Since this is a waiver, fulfill the payment immediately
$paymentManager->fulfillQueuedPayment($request, $queuedPayment, $markAsPaid ? 'ManualPayment' : 'Waiver');
} else {
// Get the issue for publication.
$issueDao = DAORegistry::getDAO('IssueDAO');
$issueId = $this->getData('issueId');
$issue = $issueDao->getById($issueId, $context->getId());
$sectionDao = DAORegistry::getDAO('SectionDAO');
$sectionEditorSubmissionDao = DAORegistry::getDAO('SectionEditorSubmissionDAO');
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticle = $publishedArticleDao->getPublishedArticleByArticleId($submission->getId(), null, false);
/* @var $publishedArticle PublishedArticle */
if ($publishedArticle) {
if (!$issue || !$issue->getPublished()) {
$fromIssue = $issueDao->getById($publishedArticle->getIssueId(), $context->getId());
if ($fromIssue->getPublished()) {
// Insert article tombstone
import('classes.article.ArticleTombstoneManager');
$articleTombstoneManager = new ArticleTombstoneManager();
$articleTombstoneManager->insertArticleTombstone($submission, $context);
}
}
}
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
// define the access status for the article if none is set.
$accessStatus = $this->getData('accessStatus') != '' ? $this->getData('accessStatus') : ARTICLE_ACCESS_ISSUE_DEFAULT;
$articleDao = DAORegistry::getDAO('ArticleDAO');
if (!is_null($this->getData('pages'))) {
$submission->setPages($this->getData('pages'));
}
if (!is_null($this->getData('publicArticleId'))) {
$articleDao->changePubId($submission->getId(), 'publisher-id', $this->getData('publicArticleId'));
}
if ($issue) {
// Schedule against an issue.
if ($publishedArticle) {
$publishedArticle->setIssueId($issueId);
$publishedArticle->setSeq(REALLY_BIG_NUMBER);
$publishedArticle->setDatePublished($this->getData('datePublished'));
$publishedArticle->setAccessStatus($accessStatus);
$publishedArticleDao->updatePublishedArticle($publishedArticle);
// Re-index the published article metadata.
$articleSearchIndex->articleMetadataChanged($publishedArticle);
} else {
$publishedArticle = $publishedArticleDao->newDataObject();
$publishedArticle->setId($submission->getId());
$publishedArticle->setIssueId($issueId);
$publishedArticle->setDatePublished(Core::getCurrentDate());
$publishedArticle->setSeq(REALLY_BIG_NUMBER);
$publishedArticle->setAccessStatus($accessStatus);
$publishedArticle->setDatePublished($this->getData('datePublished'));
$publishedArticleDao->insertPublishedArticle($publishedArticle);
// If we're using custom section ordering, and if this is the first
// article published in a section, make sure we enter a custom ordering
// for it. (Default at the end of the list.)
if ($sectionDao->customSectionOrderingExists($issueId)) {
if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) {
$sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER);
$sectionDao->resequenceCustomSectionOrders($issueId);
}
}
// Index the published article metadata and files for the first time.
$articleSearchIndex->articleMetadataChanged($publishedArticle);
$articleSearchIndex->articleFilesChanged($publishedArticle);
}
} else {
if ($publishedArticle) {
// This was published elsewhere; make sure we don't
// mess up sequencing information.
$issueId = $publishedArticle->getIssueId();
$publishedArticleDao->deletePublishedArticleByArticleId($ubmission->getId());
// Delete the article from the search index.
$articleSearchIndex->articleFileDeleted($ubmission->getId());
}
}
// Resequence the articles.
$publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId);
$submission->stampStatusModified();
$articleDao->updateObject($submission);
if ($issue && $issue->getPublished()) {
$submission->setStatus(STATUS_PUBLISHED);
// delete article tombstone
//.........这里部分代码省略.........
示例2: testDeleteTextIndexViaPluginHook
/**
* @covers ArticleSearchIndex
*/
public function testDeleteTextIndexViaPluginHook()
{
// Diverting to the search plugin hook.
HookRegistry::register('ArticleSearchIndex::articleFileDeleted', array($this, 'callbackDeleteTextIndex'));
// The search DAO should not be called.
$this->registerMockArticleSearchDAO($this->never(), $this->never());
// Simulate deleting article index via hook.
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleFileDeleted(0, 1, 2);
// Test whether the hook was called.
$calledHooks = HookRegistry::getCalledHooks();
$lastHook = array_pop($calledHooks);
self::assertEquals('ArticleSearchIndex::articleFileDeleted', $lastHook[0]);
// Remove the test hook.
HookRegistry::clear('ArticleSearchIndex::articleFileDeleted');
}
示例3: scheduleForPublication
/**
* Schedule/unschedule an article for publication.
* @param $args array
* @param $request object
*/
function scheduleForPublication($args, $request)
{
$articleId = (int) array_shift($args);
$issueId = (int) $request->getUserVar('issueId');
$this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT);
$journal =& $request->getJournal();
$submission =& $this->submission;
$sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$sectionDao =& DAORegistry::getDAO('SectionDAO');
$publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueById($issueId, $journal->getId());
if ($publishedArticle) {
if (!$issue || !$issue->getPublished()) {
$fromIssue =& $issueDao->getIssueById($publishedArticle->getIssueId(), $journal->getId());
if ($fromIssue->getPublished()) {
// Insert article tombstone
import('classes.article.ArticleTombstoneManager');
$articleTombstoneManager = new ArticleTombstoneManager();
$articleTombstoneManager->insertArticleTombstone($submission, $journal);
}
}
}
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
if ($issue) {
// Schedule against an issue.
if ($publishedArticle) {
$publishedArticle->setIssueId($issueId);
$publishedArticle->setSeq(REALLY_BIG_NUMBER);
$publishedArticleDao->updatePublishedArticle($publishedArticle);
// Re-index the published article metadata.
$articleSearchIndex->articleMetadataChanged($publishedArticle);
} else {
$publishedArticle = new PublishedArticle();
$publishedArticle->setId($submission->getId());
$publishedArticle->setIssueId($issueId);
$publishedArticle->setDatePublished(Core::getCurrentDate());
$publishedArticle->setSeq(REALLY_BIG_NUMBER);
$publishedArticle->setAccessStatus(ARTICLE_ACCESS_ISSUE_DEFAULT);
$publishedArticleDao->insertPublishedArticle($publishedArticle);
// If we're using custom section ordering, and if this is the first
// article published in a section, make sure we enter a custom ordering
// for it. (Default at the end of the list.)
if ($sectionDao->customSectionOrderingExists($issueId)) {
if ($sectionDao->getCustomSectionOrder($issueId, $submission->getSectionId()) === null) {
$sectionDao->insertCustomSectionOrder($issueId, $submission->getSectionId(), REALLY_BIG_NUMBER);
$sectionDao->resequenceCustomSectionOrders($issueId);
}
}
// Index the published article metadata and files for the first time.
$articleSearchIndex->articleMetadataChanged($publishedArticle);
$articleSearchIndex->articleFilesChanged($publishedArticle);
}
} else {
if ($publishedArticle) {
// This was published elsewhere; make sure we don't
// mess up sequencing information.
$issueId = $publishedArticle->getIssueId();
$publishedArticleDao->deletePublishedArticleByArticleId($articleId);
// Delete the article from the search index.
$articleSearchIndex->articleFileDeleted($articleId);
}
}
// Resequence the articles.
$publishedArticleDao->resequencePublishedArticles($submission->getSectionId(), $issueId);
$submission->stampStatusModified();
if ($issue && $issue->getPublished()) {
$submission->setStatus(STATUS_PUBLISHED);
// delete article tombstone
$tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO');
$tombstoneDao->deleteByDataObjectId($submission->getId());
} else {
$submission->setStatus(STATUS_QUEUED);
}
$sectionEditorSubmissionDao->updateSectionEditorSubmission($submission);
// Call initialize permissions again to check if copyright year needs to be initialized.
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article = $articleDao->getArticle($articleId);
$article->initializePermissions();
$articleDao->updateLocaleFields($article);
$articleSearchIndex->articleChangesFinished();
$request->redirect(null, null, 'submissionEditing', array($articleId), null, 'scheduling');
}
示例4: deleteSuppFile
/**
* Delete a supplementary file.
* @param $article object
* @param $suppFileId int
*/
function deleteSuppFile($article, $suppFileId)
{
$suppFileDao =& DAORegistry::getDAO('SuppFileDAO');
$suppFile =& $suppFileDao->getSuppFile($suppFileId, $article->getId());
if (isset($suppFile) && !HookRegistry::call('LayoutEditorAction::deleteSuppFile', array(&$article, &$suppFile))) {
if ($suppFile->getFileId()) {
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($article->getId());
$articleFileManager->deleteFile($suppFile->getFileId());
}
$suppFileDao->deleteSuppFile($suppFile);
// Update the search index after deleting the
// supp file so that idempotent search plug-ins
// correctly update supp file meta-data.
if ($suppFile->getFileId()) {
import('classes.search.ArticleSearchIndex');
$articleSearchIndex = new ArticleSearchIndex();
$articleSearchIndex->articleFileDeleted($article->getId(), ARTICLE_SEARCH_SUPPLEMENTARY_FILE, $suppFile->getFileId());
$articleSearchIndex->articleChangesFinished();
}
// Stamp the article modification (for OAI)
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$articleDao->updateArticle($article);
}
}