Shortcut for archive project

@param int $id

@return bool
@throws \TeamWorkPm\Exception
320765
public function archive($id)
    {
        $id = (int) $id;
        if ($id <= 0) {
            throw new Exception('Invalid param id');
        }
        $data = [];
        $data['id'] = $id;
        $data['status'] = 'archived';
        return $this->update($data);
    }
164583
public function delete($id = null)
    {
        if ($this->read_only) {
            throw new Exception(['Model is read-only and cannot be deleted']);
        }

        if ($id == $this->id) {
            $id = null;
        }

        return $this->atomic(function () use ($id) {
            if ($id) {
                $c = clone $this;
                $c->load($id)->delete();

                return $this;
            } elseif ($this->loaded()) {
                if ($this->hook('beforeDelete', [$this->id]) === false) {
                    return $this;
                }
                $this->persistence->delete($this, $this->id);
                $this->hook('afterDelete', [$this->id]);
                $this->unload();

                return $this;
            } else {
                throw new Exception(['No active record is set, unable to delete.']);
            }
        });
    }
1059444
public function run($id)
    {
        $model = $this->getModel($id);
        
        if ($model->restore()) {
            $this->addSuccessFlash();
        }

        return $this->redirect($model);
    }
1169712
public function delete(int $id)
    {
        try {
            $sh = @shmop_open($this->getSharedItemKey($id), 'w', 0, 0);
        } catch (\Throwable $e) {
            return false;
        }

        if (!$sh) {
            return false;
        }

        $deleted = shmop_delete($sh);
        shmop_close($sh);

        return $deleted;
    }
753934
public function id_to_url($id){
    if ( $file = $this->id_to_real($id) ){
      return $this->real_to_url($file);
    }
    return false;
  }
121701
public function deleteRow (int $id) : bool
	{
		$this->id = $id;
		return $this->delete() ? TRUE : FALSE;
	}
396759
public function isCached($id) {
        if ($id != null) {
            $id = $this->getIDfromOjb($id);
        }

        if ($id == null)
            return false;

        $cachefile = $this->getConfig('cacheDir') . '/' . utf8_decode($id);
        $cachetime = $this->getConfig('cacheTime');

        if (file_exists($cachefile) && time() - $cachetime < fileatime($cachefile)) {
            return true;
        }

        return false;
    }
1136640
public function handlerById($id)
    {
        if (isset($this->_handlers[$id])) {
            return $this->_handlers[$id];
        }
        throw new \Exception("Property handler with id {$id} not found");
    }
668735
public static function get( $id ) {
		if ( file_exists( Utils\get_snapshot_directory() . $id . '/meta.json' ) ) {
			$meta_file_contents = file_get_contents( Utils\get_snapshot_directory() . $id . '/meta.json' );
			$meta               = json_decode( $meta_file_contents, true );
		} else {
			$meta = [];
		}

		/**
		 * Backwards compant - need to fill in repo before we started saving repo in meta.
		 */
		if ( empty( $meta['repository'] ) ) {
			Log::instance()->write( 'Legacy snapshot found without repository. Assuming default repository.', 1, 'warning' );

			$meta['repository'] = RepositoryManager::instance()->getDefault();
		}

		return new self( $id, $meta['repository'], $meta );
	}
1011733
public function deleteSnapshot( $id ) {
		try {
			$result = $this->client->deleteItem(
				[
					'TableName' => 'wpsnapshots-' . $this->repository,
					'Key'       => [
						'id' => [
							'S' => $id,
						],
					],
				]
			);
		} catch ( \Exception $e ) {
			Log::instance()->write( 'Error Message: ' . $e->getMessage(), 1, 'error' );
			Log::instance()->write( 'AWS Request ID: ' . $e->getAwsRequestId(), 1, 'error' );
			Log::instance()->write( 'AWS Error Type: ' . $e->getAwsErrorType(), 1, 'error' );
			Log::instance()->write( 'AWS Error Code: ' . $e->getAwsErrorCode(), 1, 'error' );

			return false;
		}

		return true;
	}
749913
public function all($id = null)
    {
        if (!is_int($id)) {
            return $this->get('/repositories');
        }

        return $this->get('/repositories?since='.rawurldecode($id));
    }
637878
public function delete($id)
    {
        $result = null;
        $this->hook->attach('module.backup.delete.before', $id, $this);

        if (isset($result)) {
            return $result;
        }

        $result = $this->deleteZip($id);

        if ($result) {
            $this->db->delete('backup', array('backup_id' => $id));
        }

        $this->hook->attach('module.backup.delete.after', $id, $result, $this);
        return (bool) $result;
    }
364285
public function deleteFileById($id)
    {
        if ($id instanceof \MongoId) {
            $result = $this->getMongoCollection()->delete($id);
        } else {
            try {
                $result = $this->getMongoCollection()->delete(new \MongoId($id));
            } catch (\MongoException $e) {
                $result = $this->getMongoCollection()->delete($id);
            }
        }
        if ($result['ok'] !== (double) 1) {
            throw new Exception('Error deleting file: ' . $result['err'] . ': ' . $result['errmsg']);
        }
        
        return $this;
    }
65625
public function remove_shortcut($id): ?int
  {
    if ( \bbn\str::is_uid($id) ){
      return $this->pref->delete_bit($id);
    }
    return null;
  }
668037
protected function _recursiveMkdirAndChmod($id)
    {
        if ($this->_options['hashed_directory_level'] <=0) {
            return true;
        }
        $partsArray = $this->_path($id, true);
        foreach ($partsArray as $part) {
            if (!is_dir($part)) {
                @mkdir($part, $this->_options['hashed_directory_umask']);
                @chmod($part, $this->_options['hashed_directory_umask']); // see #ZF-320 (this line is required in some configurations)
            }
        }
        return true;
    }
434530
public function actionView($id)
    {
        $record = $this->findRecord($id);
        if ($record->lastExec && $record->lastExec->isFailed()) {
            return $this->redirect(['view-attempts', 'id' => $record->id]);
        }
        return $this->redirect(['view-details', 'id' => $record->id]);
    }
376396
public function run($id)
    {
        /** @var ActiveRecord|TreeInterface $model */
        $model = $this->findModel($id);

        $form = new MoveNodeForm();

        $params = Yii::$app->getRequest()->getBodyParams();
        $form->load($params, '');

        if (!$form->validate()) {
            return $form;
        }

        try {
            if ($form->prev_id > 0) {
                $parentModel = $this->findModel($form->prev_id);
                if ($parentModel->isRoot()) {
                    return $model->appendTo($parentModel)->save();
                } else {
                    return $model->insertAfter($parentModel)->save();
                }
            } elseif ($form->next_id > 0) {
                $parentModel = $this->findModel($form->next_id);
                return $model->insertBefore($parentModel)->save();
            } elseif ($form->parent_id > 0) {
                $parentModel = $this->findModel($form->parent_id);
                return $model->appendTo($parentModel)->save();
            }
        } catch (Exception $ex) {
        }

        return false;
    }