public function remove(array $ancestors = array()) { $removed = parent::remove(); if ($removed) { $this->clearCache(); } return $removed; }
/** * @param array $ancestors * * @return bool */ public function remove(array $ancestors = array()) { /** @var TicketAuthor $profile */ if ($profile = $this->xpdo->getObject('TicketAuthor', $this->get('uid'))) { $profile->removeAction('view', $this->get('parent'), $this->get('uid')); } return parent::remove($ancestors); }
public function remove(array $ancestors = array()) { $removed = parent::remove($ancestors); if ($removed && !$this->getOption(xPDO::OPT_SETUP)) { $this->xpdo->call('modNamespace', 'clearCache', array(&$this->xpdo)); } return $removed; }
/** * Overrides xPDOObject::remove to fire modX-specific events. * * {@inheritDoc} */ public function remove(array $ancestors = array()) { if ($this->xpdo instanceof modX) { $this->xpdo->invokeEvent('OnPluginEventBeforeRemove', array('pluginEvent' => &$this, 'ancestors' => $ancestors)); } $removed = parent::remove($ancestors); if ($removed && $this->xpdo instanceof modX) { $this->xpdo->invokeEvent('OnPluginEventRemove', array('pluginEvent' => &$this, 'ancestors' => $ancestors)); } return $removed; }
/** * @param array $ancestors * * @return bool */ public function remove(array $ancestors = array()) { $type = ''; $class = $this->get('class'); if ($class == 'TicketComment') { $type = 'vote_comment'; } elseif ($class == 'Ticket') { $type = 'vote_ticket'; } if (!empty($type)) { /** @var TicketAuthor $profile */ if ($profile = $this->xpdo->getObject('TicketAuthor', $this->get('owner'))) { $profile->removeAction($type, $this->id, $this->get('createdby')); } } return parent::remove($ancestors); }
/** * {@inheritdoc} * Delete option values for product in category while remove option from category */ public function remove(array $ancestors = array()) { $q = $this->xpdo->newQuery('msProduct', array('parent' => $this->get('category_id'))); $q->select('id'); if ($q->prepare() && $q->stmt->execute()) { $products = $q->stmt->fetchAll(PDO::FETCH_COLUMN); $products = implode(',', $products); $key = $this->getOne('Option')->get('key'); $key = $this->xpdo->quote($key); if (count($products) > 0) { $sql = "DELETE FROM {$this->xpdo->getTableName('msProductOption')} WHERE `product_id` IN ({$products}) AND `key`={$key};"; $stmt = $this->xpdo->prepare($sql); $stmt->execute(); $stmt->closeCursor(); } } return parent::remove($ancestors); }
/** * Custom remove that respects access policies. * * {@inheritdoc} */ public function remove(array $ancestors = array()) { $removed = false; if (!$this->checkPolicy('remove')) { $this->xpdo->error->failure($this->xpdo->lexicon('permission_denied')); } $removed = parent::remove($ancestors); return $removed; }
/** * Overrides xPDOObject::remove. Removes and uninstalls the package. * * {@inheritdoc} */ public function remove($force = false, array $ancestors = array(), $uninstall = true) { $removed = false; if ($this->get('installed') == null || $this->get('installed') == '0000-00-00 00:00:00') { $uninstalled = true; } else { if ($uninstall) { $uninstalled = $this->uninstall(); } } if ($uninstalled || $force) { $removed = parent::remove($ancestors); } return $removed; }
/** * We override the parent func so we can clean out the asset files */ public function remove(array $ancestors = array()) { $storage_basedir = $this->xpdo->getOption('assets_path') . rtrim($this->xpdo->getOption('assman.library_path'), '/') . '/'; $this->xpdo->log(\modX::LOG_LEVEL_DEBUG, 'Removing Asset ' . $this->getPrimaryKey() . ' with assets in storage_basedir ' . $storage_basedir, '', __CLASS__, __FILE__, __LINE__); $file = $this->get('path'); if (file_exists($file)) { if (!unlink($file)) { $this->xpdo->log(\modX::LOG_LEVEL_ERROR, 'Failed to remove file asset for Asset ' . $this->getPrimaryKey() . ': ' . $file, '', __CLASS__, __FILE__, __LINE__); throw new \Exception('Failed to delete asset file.'); } } else { $this->xpdo->log(\modX::LOG_LEVEL_INFO, 'File does not exist for Asset ' . $this->getPrimaryKey() . ': ' . $file . ' This could be because the file was manually deleted or because you did not pass the $storage_basedir parameter.', '', __CLASS__, __FILE__, __LINE__); } // remove thumbnails $storage_basedir = $this->xpdo->getOption('assets_path') . rtrim($this->xpdo->getOption('assman.library_path'), '/') . '/'; $dir = $storage_basedir . 'resized/' . $this->get('asset_id') . '/'; self::rrmdir($dir); return parent::remove($ancestors); }