当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorDestructionEngine::destroyObject方法代码示例

本文整理汇总了PHP中PhabricatorDestructionEngine::destroyObject方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorDestructionEngine::destroyObject方法的具体用法?PHP PhabricatorDestructionEngine::destroyObject怎么用?PHP PhabricatorDestructionEngine::destroyObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorDestructionEngine的用法示例。


在下文中一共展示了PhabricatorDestructionEngine::destroyObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteFile

 public function deleteFile($handle)
 {
     $engine = new PhabricatorDestructionEngine();
     $chunks = $this->loadAllChunks($handle, true);
     foreach ($chunks as $chunk) {
         $engine->destroyObject($chunk);
     }
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:8,代码来源:PhabricatorChunkedFileStorageEngine.php

示例2: applyExternalEffects

 public function applyExternalEffects($object, $value)
 {
     $events = id(new PhabricatorCalendarEventQuery())->setViewer($this->getActor())->withImportSourcePHIDs(array($object->getPHID()))->execute();
     $engine = new PhabricatorDestructionEngine();
     foreach ($events as $event) {
         $engine->destroyObject($event);
     }
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:8,代码来源:PhabricatorCalendarImportDeleteTransaction.php

示例3: destroyObjectPermanently

 public function destroyObjectPermanently(PhabricatorDestructionEngine $engine)
 {
     $bindings = id(new AlmanacBindingQuery())->setViewer($engine->getViewer())->withInterfacePHIDs(array($this->getPHID()))->execute();
     foreach ($bindings as $binding) {
         $engine->destroyObject($binding);
     }
     $this->delete();
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:AlmanacInterface.php

示例4: destroyObject

 public function destroyObject(PhabricatorDestructionEngine $engine, $object)
 {
     $template = $object->getApplicationTransactionTemplate();
     $xactions = $template->loadAllWhere('objectPHID = %s', $object->getPHID());
     foreach ($xactions as $xaction) {
         $engine->destroyObject($xaction);
     }
 }
开发者ID:truSense,项目名称:phabricator,代码行数:8,代码来源:PhabricatorTransactionsDestructionEngineExtension.php

示例5: destroyObject

 public function destroyObject(PhabricatorDestructionEngine $engine, $object)
 {
     $object_phid = $object->getPHID();
     $transcripts = id(new HeraldTranscript())->loadAllWhere('objectPHID = %s', $object_phid);
     foreach ($transcripts as $transcript) {
         $engine->destroyObject($transcript);
     }
 }
开发者ID:truSense,项目名称:phabricator,代码行数:8,代码来源:HeraldTranscriptDestructionEngineExtension.php

示例6: destroyObjectPermanently

 public function destroyObjectPermanently(PhabricatorDestructionEngine $engine)
 {
     $interfaces = id(new AlmanacInterfaceQuery())->setViewer($engine->getViewer())->withNetworkPHIDs(array($this->getPHID()))->execute();
     foreach ($interfaces as $interface) {
         $engine->destroyObject($interface);
     }
     $this->delete();
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:8,代码来源:AlmanacNetwork.php

示例7: collectGarbage

 protected function collectGarbage()
 {
     $file_requests = id(new PhabricatorFileExternalRequest())->loadAllWhere('ttl < %d LIMIT 100', PhabricatorTime::getNow());
     $engine = new PhabricatorDestructionEngine();
     foreach ($file_requests as $request) {
         $engine->destroyObject($request);
     }
     return count($file_requests) == 100;
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:9,代码来源:PhabricatorFileExternalRequestGarbageCollector.php

示例8: destroyObjectPermanently

 public function destroyObjectPermanently(PhabricatorDestructionEngine $engine)
 {
     $file_phid = $this->getFilePHID();
     $file = id(new PhabricatorFileQuery())->setViewer($engine->getViewer())->withPHIDs(array($file_phid))->executeOne();
     if ($file) {
         $engine->destroyObject($file);
     }
     $this->delete();
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:9,代码来源:PhabricatorRepositoryGitLFSRef.php

示例9: destroyObjectPermanently

 public function destroyObjectPermanently(PhabricatorDestructionEngine $engine)
 {
     $viewer = $engine->getViewer();
     $this->openTransaction();
     $packages = id(new PhabricatorPackagesPackageQuery())->setViewer($viewer)->withPublisherPHIDs(array($this->getPHID()))->execute();
     foreach ($packages as $package) {
         $engine->destroyObject($package);
     }
     $this->delete();
     $this->saveTransaction();
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:11,代码来源:PhabricatorPackagesPublisher.php

示例10: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $show_prototypes = PhabricatorEnv::getEnvConfig('phabricator.show-prototypes');
     if (!$show_prototypes) {
         throw new Exception(pht('Show prototypes is disabled.
       Set `phabricator.show-prototypes` to `true` to use the image proxy'));
     }
     $viewer = $request->getViewer();
     $img_uri = $request->getStr('uri');
     // Validate the URI before doing anything
     PhabricatorEnv::requireValidRemoteURIForLink($img_uri);
     $uri = new PhutilURI($img_uri);
     $proto = $uri->getProtocol();
     if (!in_array($proto, array('http', 'https'))) {
         throw new Exception(pht('The provided image URI must be either http or https'));
     }
     // Check if we already have the specified image URI downloaded
     $cached_request = id(new PhabricatorFileExternalRequest())->loadOneWhere('uriIndex = %s', PhabricatorHash::digestForIndex($img_uri));
     if ($cached_request) {
         return $this->getExternalResponse($cached_request);
     }
     $ttl = PhabricatorTime::getNow() + phutil_units('7 days in seconds');
     $external_request = id(new PhabricatorFileExternalRequest())->setURI($img_uri)->setTTL($ttl);
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     // Cache missed so we'll need to validate and download the image
     try {
         // Rate limit outbound fetches to make this mechanism less useful for
         // scanning networks and ports.
         PhabricatorSystemActionEngine::willTakeAction(array($viewer->getPHID()), new PhabricatorFilesOutboundRequestAction(), 1);
         $file = PhabricatorFile::newFromFileDownload($uri, array('viewPolicy' => PhabricatorPolicies::POLICY_NOONE, 'canCDN' => true));
         if (!$file->isViewableImage()) {
             $mime_type = $file->getMimeType();
             $engine = new PhabricatorDestructionEngine();
             $engine->destroyObject($file);
             $file = null;
             throw new Exception(pht('The URI "%s" does not correspond to a valid image file, got ' . 'a file with MIME type "%s". You must specify the URI of a ' . 'valid image file.', $uri, $mime_type));
         } else {
             $file->save();
         }
         $external_request->setIsSuccessful(true)->setFilePHID($file->getPHID())->save();
         unset($unguarded);
         return $this->getExternalResponse($external_request);
     } catch (HTTPFutureHTTPResponseStatus $status) {
         $external_request->setIsSuccessful(false)->setResponseMessage($status->getMessage())->save();
         return $this->getExternalResponse($external_request);
     } catch (Exception $ex) {
         // Not actually saving the request in this case
         $external_request->setResponseMessage($ex->getMessage());
         return $this->getExternalResponse($external_request);
     }
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:51,代码来源:PhabricatorFileImageProxyController.php

示例11: destroyObjectPermanently

 public function destroyObjectPermanently(PhabricatorDestructionEngine $engine)
 {
     $this->openTransaction();
     $diffs = id(new DifferentialDiffQuery())->setViewer($engine->getViewer())->withRevisionIDs(array($this->getID()))->execute();
     foreach ($diffs as $diff) {
         $engine->destroyObject($diff);
     }
     $conn_w = $this->establishConnection('w');
     queryfx($conn_w, 'DELETE FROM %T WHERE revisionID = %d', self::TABLE_COMMIT, $this->getID());
     // we have to do paths a little differentally as they do not have
     // an id or phid column for delete() to act on
     $dummy_path = new DifferentialAffectedPath();
     queryfx($conn_w, 'DELETE FROM %T WHERE revisionID = %d', $dummy_path->getTableName(), $this->getID());
     $this->delete();
     $this->saveTransaction();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:16,代码来源:DifferentialRevision.php

示例12: returnDeleteAddressResponse

 private function returnDeleteAddressResponse(AphrontRequest $request, PhutilURI $uri, $email_object_id)
 {
     $viewer = $this->getViewer();
     $email_object = id(new PhabricatorMetaMTAApplicationEmailQuery())->setViewer($viewer)->withIDs(array($email_object_id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
     if (!$email_object) {
         return new Aphront404Response();
     }
     if ($request->isDialogFormPost()) {
         $engine = new PhabricatorDestructionEngine();
         $engine->destroyObject($email_object);
         return id(new AphrontRedirectResponse())->setURI($uri);
     }
     $dialog = id(new AphrontDialogView())->setUser($viewer)->addHiddenInput('delete', $email_object_id)->setTitle(pht('Delete Address'))->appendParagraph(pht('Are you sure you want to delete this email address?'))->addSubmitButton(pht('Delete'))->addCancelButton($uri);
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:15,代码来源:PhabricatorMetaMTAApplicationEmailPanel.php

示例13: applyFinalEffects

 protected function applyFinalEffects(PhabricatorLiskDAO $object, array $xactions)
 {
     $actor = $this->getActor();
     // We import events when you create a source, or if you later reload it
     // explicitly.
     $should_reload = $this->getIsNewObject();
     // We adjust the import trigger if you change the import frequency or
     // disable the import.
     $should_trigger = false;
     foreach ($xactions as $xaction) {
         $xaction_type = $xaction->getTransactionType();
         switch ($xaction_type) {
             case PhabricatorCalendarImportReloadTransaction::TRANSACTIONTYPE:
                 $should_reload = true;
                 break;
             case PhabricatorCalendarImportFrequencyTransaction::TRANSACTIONTYPE:
                 $should_trigger = true;
                 break;
             case PhabricatorCalendarImportDisableTransaction::TRANSACTIONTYPE:
                 $should_trigger = true;
                 break;
         }
     }
     if ($should_reload) {
         $import_engine = $object->getEngine();
         $import_engine->importEventsFromSource($actor, $object, true);
     }
     if ($should_trigger) {
         $trigger_phid = $object->getTriggerPHID();
         if ($trigger_phid) {
             $trigger = id(new PhabricatorWorkerTriggerQuery())->setViewer($actor)->withPHIDs(array($trigger_phid))->executeOne();
             if ($trigger) {
                 $engine = new PhabricatorDestructionEngine();
                 $engine->destroyObject($trigger);
             }
         }
         $frequency = $object->getTriggerFrequency();
         $now = PhabricatorTime::getNow();
         switch ($frequency) {
             case PhabricatorCalendarImport::FREQUENCY_ONCE:
                 $clock = null;
                 break;
             case PhabricatorCalendarImport::FREQUENCY_HOURLY:
                 $clock = new PhabricatorMetronomicTriggerClock(array('period' => phutil_units('1 hour in seconds')));
                 break;
             case PhabricatorCalendarImport::FREQUENCY_DAILY:
                 $clock = new PhabricatorDailyRoutineTriggerClock(array('start' => $now));
                 break;
             default:
                 throw new Exception(pht('Unknown import trigger frequency "%s".', $frequency));
         }
         // If the object has been disabled, don't write a new trigger.
         if ($object->getIsDisabled()) {
             $clock = null;
         }
         if ($clock) {
             $trigger_action = new PhabricatorScheduleTaskTriggerAction(array('class' => 'PhabricatorCalendarImportReloadWorker', 'data' => array('importPHID' => $object->getPHID(), 'via' => PhabricatorCalendarImportReloadWorker::VIA_TRIGGER), 'options' => array('objectPHID' => $object->getPHID(), 'priority' => PhabricatorWorker::PRIORITY_BULK)));
             $trigger_phid = PhabricatorPHID::generateNewPHID(PhabricatorWorkerTriggerPHIDType::TYPECONST);
             $object->setTriggerPHID($trigger_phid)->save();
             $trigger = id(new PhabricatorWorkerTrigger())->setClock($clock)->setAction($trigger_action)->setPHID($trigger_phid)->save();
         } else {
             $object->setTriggerPHID(null)->save();
         }
     }
     return $xactions;
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:66,代码来源:PhabricatorCalendarImportEditor.php

示例14: destroyObjectPermanently

 public function destroyObjectPermanently(PhabricatorDestructionEngine $engine)
 {
     $phid = $this->getPHID();
     $this->openTransaction();
     $this->delete();
     PhabricatorRepositoryURIIndex::updateRepositoryURIs($phid, array());
     $books = id(new DivinerBookQuery())->setViewer($engine->getViewer())->withRepositoryPHIDs(array($phid))->execute();
     foreach ($books as $book) {
         $engine->destroyObject($book);
     }
     $atoms = id(new DivinerAtomQuery())->setViewer($engine->getViewer())->withRepositoryPHIDs(array($phid))->execute();
     foreach ($atoms as $atom) {
         $engine->destroyObject($atom);
     }
     $lfs_refs = id(new PhabricatorRepositoryGitLFSRefQuery())->setViewer($engine->getViewer())->withRepositoryPHIDs(array($phid))->execute();
     foreach ($lfs_refs as $ref) {
         $engine->destroyObject($ref);
     }
     $this->saveTransaction();
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:20,代码来源:PhabricatorRepository.php

示例15: destroyObjectPermanently

 public function destroyObjectPermanently(PhabricatorDestructionEngine $engine)
 {
     $this->openTransaction();
     $diffs = id(new DifferentialDiffQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withRevisionIDs(array($this->getID()))->execute();
     foreach ($diffs as $diff) {
         $engine->destroyObject($diff);
     }
     $conn_w = $this->establishConnection('w');
     queryfx($conn_w, 'DELETE FROM %T WHERE revisionID = %d', self::TABLE_COMMIT, $this->getID());
     try {
         $inlines = id(new DifferentialInlineCommentQuery())->withRevisionIDs(array($this->getID()))->execute();
         foreach ($inlines as $inline) {
             $inline->delete();
         }
     } catch (PhabricatorEmptyQueryException $ex) {
         // TODO: There's still some funky legacy wrapping going on here, and
         // we might catch a raw query exception.
     }
     // we have to do paths a little differentally as they do not have
     // an id or phid column for delete() to act on
     $dummy_path = new DifferentialAffectedPath();
     queryfx($conn_w, 'DELETE FROM %T WHERE revisionID = %d', $dummy_path->getTableName(), $this->getID());
     $this->delete();
     $this->saveTransaction();
 }
开发者ID:denghp,项目名称:phabricator,代码行数:25,代码来源:DifferentialRevision.php


注:本文中的PhabricatorDestructionEngine::destroyObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。