Execute unpublishing documents
416
private function manageDeleteDocument(&$params, &$dmsLoader, &$manageCategory, &$arrMessages, &$blnShowStart, $documentId)
  {
    $params->loadRootCategory = true; // get complete path to root, for checking inherited access rights
    $params->loadAccessRights = true;
    $params->loadDocuments = false;
    $category = $dmsLoader->loadCategory($manageCategory, $params);
    
    if (!$category->isDeletableForCurrentMember())
    {
      $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['manage_document_not_allowed'];
      $blnShowStart = true;
    }
    else
    {
      $document = $dmsLoader->loadDocument($documentId, $params);
      
      if ($document != null)
      {
        // delete the document in the database
        $dmsWriter = \DmsWriter::getInstance();
        
        if ($dmsWriter->deleteDocument($document))
        {
          $arrMessages['successes'][] = $GLOBALS['TL_LANG']['DMS']['SUCCESS']['document_successfully_deleted'];
          
          // delete the file
          $filePath = \DmsConfig::getDocumentFilePath($document->getFileNameVersioned());
          if (file_exists(TL_ROOT . '/' . $filePath))
          {
            unlink($filePath);
            \Dbafs::deleteResource($filePath);
            
            $arrMessages['successes'][] = $GLOBALS['TL_LANG']['DMS']['SUCCESS']['document_file_successfully_deleted'];
          }
          else
          {
            $arrMessages['infos'][] = $GLOBALS['TL_LANG']['DMS']['INFO']['document_delete_file_not_exists'];
          }
        }
        else
        {
          $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['delete_document_failed'];
        }
      }
      else
      {
        $arrMessages['errors'][] = $GLOBALS['TL_LANG']['DMS']['ERR']['manage_document_not_found'];
      }
      $this->manageSelectDocument($params, $dmsLoader, $manageCategory, $arrMessages, $blnShowStart);
    }
  }
597960
public void purge(@NonNull Document document) throws CouchbaseLiteException {
        if (document == null) { throw new IllegalArgumentException("document cannot be null."); }

        if (document.isNewDocument()) {
            throw new CouchbaseLiteException("Document doesn't exist in the database.",
                CBLError.Domain.CBLITE, CBLError.Code.NOT_FOUND);
        }

        synchronized (lock) {
            prepareDocument(document);

            boolean commit = false;
            beginTransaction();
            try {
                // revID: null, all revisions are purged.
                if (document.getC4doc().purgeRevision(null) >= 0) {
                    document.getC4doc().save(0);
                    // Reset c4doc:
                    document.replaceC4Document(null);
                    commit = true;
                }
            }
            catch (LiteCoreException e) {
                throw CBLStatus.convertException(e);
            }
            finally {
                endTransaction(commit);
            }
        }
    }
380411
function unpublishPage(uri, user) {
  const update = {
    published: false,
    publishTime: null,
    url: '',
    history: [{ action: 'unpublish', timestamp: new Date().toISOString(), users: [userOrRobot(user)] }]
  };

  return changeMetaState(uri, update);
}
1324148
public static function unpublish($publication) {
        global $DB;
        // Unpublish the publication by web service.
        api::unregister_courses($publication->hubcourseid);

        // Delete the publication from the database.
        $DB->delete_records('course_published', array('id' => $publication->id));

        // Add confirmation message.
        $course = get_course($publication->courseid);
        $context = \context_course::instance($course->id);
        $publication->courseshortname = format_string($course->shortname, true, ['context' => $context]);
        $publication->hubname = 'Moodle.net';
        \core\notification::add(get_string('courseunpublished', 'hub', $publication), \core\output\notification::NOTIFY_SUCCESS);
    }
248707
def unpublish(self):
        
        if self.is_draft and self.publishing_linked:
            publishing_signals.publishing_pre_unpublish.send(
                sender=type(self), instance=self)
            # Unlink draft and published copies then delete published.
            # NOTE: This indirect dance is necessary to avoid triggering
            # unwanted MPTT tree structure updates via `delete`.
            type(self.publishing_linked).objects \
                .filter(pk=self.publishing_linked.pk) \
                .delete()  # Instead of self.publishing_linked.delete()
            # NOTE: We update and save the object *after* deleting the
            # published version, in case the `save()` method does some
            # validation that breaks when unlinked published objects exist.
            self.publishing_linked = None
            self.publishing_published_at = None

            # Save the draft to remove its relationship with the published copy
            publishing_signals.publishing_unpublish_save_draft.send(
                sender=type(self), instance=self)

            publishing_signals.publishing_post_unpublish.send(
                sender=type(self), instance=self)
657800
public function deindexUnpublishedDocument(UnpublishEvent $event)
    {
        $document = $event->getDocument();

        if (!$document instanceof StructureBehavior) {
            return;
        }

        $this->searchManager->deindex($document);
    }
111595
def process_action(self):
        
        if self.publish_version == self.UNPUBLISH_CHOICE:
            actioned = self._unpublish()
        else:
            actioned = self._publish()

        # Only log if an action was actually taken
        if actioned:
            self._log_action()

        return actioned
807480
function () {
        var self = this;

        // Unbind all events bound to window/document by editor instance
        if (self.boundEvents) {
          var i = self.boundEvents.length;

          while (i--) {
            var item = self.boundEvents[i];
            this.events.unbind(item[0], item[1], item[2]);
          }

          self.boundEvents = null;
        }

        // Restore sizzle document to window.document
        // Since the current document might be removed producing "Permission denied" on IE see #6325
        if (Sizzle.setDocument) {
          Sizzle.setDocument();
        }

        self.win = self.doc = self.root = self.events = self.frag = null;
      }
5655
def _updateObject(self, xref, text, page=None):
        """"""
        if self.isClosed or self.isEncrypted:
            raise ValueError("operation illegal for closed / encrypted doc")

        return _fitz.Document__updateObject(self, xref, text, page)
574160
function onAfterUnpublish() {
		if (!self::$indexing) return;

		$this->searchService->unindex($this->owner);
		$this->reindex('Stage');
	}
474819
def unpublish(self):
        

        self._client._delete(
            "{0}/published".format(
                self.__class__.base_url(
                    self.sys['space'].id,
                    self.sys['id'],
                    environment_id=self._environment_id
                ),
            ),
            headers=self._update_headers()
        )

        return self.reload()
44054
def rm_docs(self):
        """"""
        for filename in self.created:
            if os.path.exists(filename):
                os.unlink(filename)
1021653
function onAfterUnpublish() {
        if (\Config::inst()->get('ElasticSearch', 'disabled')) {
            return;
        }
        
		$this->service->remove($this->owner, 'Live');
        $this->service->index($this->owner, 'Stage');
	}
1335036
function exec() {

  // NOTE: pardon this cli target to Couchpenter methods mapping,
  // needed to preserve backward compatibility w/ v0.1.x
  const FUNCTIONS = {
    setup: 'setUp',
    'setup-db': 'setUpDatabases',
    'setup-doc': 'setUpDocuments',
    'setup-doc-overwrite': 'setUpDocumentsOverwrite',
    teardown: 'tearDown',
    'teardown-db': 'tearDownDatabases',
    'teardown-doc': 'tearDownDocuments',
    reset: 'reset',
    'reset-db': 'resetDatabases',
    'reset-doc': 'resetDocuments',
    clean: 'clean',
    'clean-db': 'cleanDatabases',
    'warm-view': 'warmViews',
    'live-deploy-view': 'liveDeployView'
  };

  var actions = {
    commands: {
      init: { action: _init }
    }
  };

  _.keys(FUNCTIONS).forEach(function (task) {
    actions.commands[task] = { action: _task(FUNCTIONS[task]) };
  });

  cli.command(__dirname, actions);
}
354721
def unregister(self, document):
        
        if document not in self.documents.keys():
            self.log.warning("Can not unregister document %s" % document)
        else:
            del (self.documents[document])
            self.__log.debug("Document %s got unregistered" % document)
444443
private void purgeExpiredDocuments() {
        // Aligning with database/document change notification to avoid race condition
        // between ending transaction and handling change notification when the documents
        // are purged
        scheduleOnPostNotificationExecutor(
            new Runnable() {
                @Override
                public void run() {
                    final int nPurged = getC4Database().purgeExpiredDocs();
                    Log.v(DOMAIN, "Purged %d expired documents", nPurged);
                    scheduleDocumentExpiration(1000);
                }
            },
            0);
    }
817559
function execute() {

    if (dryRun) {
        console.log(`In ${destDir}, this script would...`);
    } else {
        console.log(`Generating API documentation using TypeDoc...`);
    }

    const packages = path.resolve(rootDir, srcDir);

    glob(packages, {realpath:true}, function(error, srcFiles) {
       
        srcFiles.forEach((srcPath) => {    
            
            var valid = true;

            var packageName = srcPath
                .split(path.sep)
                .pop();

            excludedPackages.forEach((excludedPackageName) => {
                if (packageName === excludedPackageName) {
                    console.log(chalk.yellow(`...skip generating TypeDoc API files for ${packageName}`));
                    valid = false;
                }
            });

            if(valid) {
                dryRun ? console.log(`...generate TypeDoc API files for ${packageName}`) : createAPIFiles(packageName, srcPath);
            }

        });

    });
}