Ejemplo n.º 1
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param      Connection $con
  * @return     void
  * @throws     PropelException
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete($con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(ProcessFilesPeer::DATABASE_NAME);
     }
     try {
         $con->begin();
         ProcessFilesPeer::doDelete($this, $con);
         $this->setDeleted(true);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }
Ejemplo n.º 2
0
 /**
  *
  * @param string $sProcessUID {@min 32} {@max 32}
  * @param array  $path
  *
  * @access public
  */
 public function deleteFolderProcessFilesManager($sProcessUID, $path)
 {
     try {
         $sDirToDelete = end(explode("/",$path));
         $sPath = str_replace($sDirToDelete,'',$path);
         $sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1);
         $sMainDirectory = current(explode("/", $path));
         $sSubDirectory = substr(str_replace($sMainDirectory,'',$sSubDirectory),1);
         switch ($sMainDirectory) {
             case 'templates':
                 $sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : '');
                 break;
             case 'public':
                 $sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . ($sSubDirectory != '' ? $sSubDirectory . PATH_SEP : '');
                 break;
             default:
                 die();
                 break;
         }
         if (file_exists($sDirectory.$sDirToDelete)) {
             \G::rm_dir($sDirectory.$sDirToDelete);
         } else {
             throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('path')));
         }
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\ProcessFilesPeer::PRF_PATH);
         $criteria->add( \ProcessFilesPeer::PRF_PATH, '%' . $sDirectory.$sDirToDelete. PATH_SEP . '%', \Criteria::LIKE );
         $rs = \ProcessFilesPeer::doDelete($criteria);
         return $sDirectory.$sDirToDelete;
     } catch (Exception $e) {
         throw $e;
     }
 }