Example #1
0
 public function UnInstall()
 {
     $tables = $sequences = array();
     if (!$this->isEnabled("installer")) {
         throw new Interspire_Addons_Exception("The Addon (Advanced Addons Installer) is required", Interspire_Addons_Exception::AddonDoesntExist);
     } else {
         $this->Process("installer", "GetApi", "installer")->uninstall($this->addon_name);
     }
     $this->db->StartTransaction();
     try {
         $this->Disable();
     } catch (Interspire_Addons_Exception $e) {
         $this->db->RollbackTransaction();
         throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode());
     }
     require dirname(__FILE__) . '/schema.' . SENDSTUDIO_DATABASE_TYPE . '.php';
     try {
         $status = parent::UnInstall();
     } catch (Interspire_Addons_Exception $e) {
         $this->db->RollbackTransaction();
         throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode());
     }
     $this->db->CommitTransaction();
     return true;
 }
 /**
  * UnInstall
  * Drop tables the addon created.
  * It includes the schema files (based on the database type) and drops the bits it created.
  * Once that's done, it calls the parent UnInstall method to do its work.
  *
  * @uses Interspire_Addons::UnInstall
  * @uses Interspire_Addons_Exception
  *
  * @return Returns true if the addon was uninstalled successfully.
  * @throws Throws an Interspire_Addons_Exception::DatabaseError if one of the tables it created couldn't be removed. If the parent::UnInstall method throws an exception, this will
  * just re-throw that error.
  */
 public function UnInstall()
 {
     $tables = $sequences = array();
     $this->db->StartTransaction();
     try {
         $this->Disable();
     } catch (Interspire_Addons_Exception $e) {
         $this->db->RollbackTransaction();
         throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode());
     }
     require dirname(__FILE__) . '/schema.' . SENDSTUDIO_DATABASE_TYPE . '.php';
     foreach ($tables as $tablename) {
         $query = 'DROP TABLE [|PREFIX|]' . $tablename . ' CASCADE';
         $result = $this->db->Query($query);
         if (!$result) {
             $this->db->RollbackTransaction();
             throw new Interspire_Addons_Exception("There was a problem running query " . $query . ": " . $this->db->GetErrorMsg(), Interspire_Addons_Exception::DatabaseError);
         }
     }
     foreach ($sequences as $sequencename) {
         $query = 'DROP SEQUENCE [|PREFIX|]' . $sequencename;
         $result = $this->db->Query($query);
         if (!$result) {
             $this->db->RollbackTransaction();
             throw new Interspire_Addons_Exception("There was a problem running query " . $query . ": " . $this->db->GetErrorMsg(), Interspire_Addons_Exception::DatabaseError);
         }
     }
     try {
         $status = parent::UnInstall();
     } catch (Interspire_Addons_Exception $e) {
         $this->db->RollbackTransaction();
         throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode());
     }
     $this->db->CommitTransaction();
     return true;
 }
Example #3
0
 /**
  * UnInstall
  * Drop tables the addon created.
  * It includes the schema files (based on the database type) and drops the bits it created.
  * Once that's done, it calls the parent UnInstall method to do its work.
  *
  * @uses Interspire_Addons::UnInstall
  * @uses Interspire_Addons_Exception
  *
  * @return Returns true if the addon was uninstalled successfully.
  * @throws Throws an Interspire_Addons_Exception::DatabaseError if one of the tables it created couldn't be removed. If the parent::UnInstall method throws an exception, this will
  * just re-throw that error.
  */
 public function UnInstall()
 {
     $tables = $sequences = array();
     if (!$this->isEnabled("installer")) {
         throw new Interspire_Addons_Exception("The Addon (Advanced Addons Installer) is required", Interspire_Addons_Exception::AddonDoesntExist);
     } else {
         $this->Process("installer", "GetApi", "installer")->uninstall($this->addon_name);
     }
     $this->db->StartTransaction();
     try {
         $this->Disable();
     } catch (Interspire_Addons_Exception $e) {
         $this->db->RollbackTransaction();
         throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode());
     }
     require dirname(__FILE__) . '/schema.' . SENDSTUDIO_DATABASE_TYPE . '.php';
     /*foreach ($tables as $tablename) {
     			$query = 'DROP TABLE [|PREFIX|]' . $tablename . ' CASCADE';
     			$result = $this->db->Query($query);
     			if (!$result) {
     				$this->db->RollbackTransaction();
     				throw new Interspire_Addons_Exception("There was a problem running query " . $query . ": " . $this->db->GetErrorMsg(), Interspire_Addons_Exception::DatabaseError);
     			}
     		}*/
     try {
         $status = parent::UnInstall();
     } catch (Interspire_Addons_Exception $e) {
         $this->db->RollbackTransaction();
         throw new Interspire_Addons_Exception($e->getMessage(), $e->getCode());
     }
     $this->db->CommitTransaction();
     return true;
 }