Example #1
0
 /**
  * Uninstall
  * This is called when the addon is uninstalled in the main application.
  *
  * @uses default_settings
  * @uses Interspire_Addons::Install
  * @uses Interspire_Addons_Exception
  *
  * @throws Throws an Interspire_Addons_Exception if something goes wrong with the install process.
  * @return True Returns true if all goes ok with the install.
  */
 public function Uninstall()
 {
     // $prefix = $this->db->TablePrefix;
     // $query[] = "DROP TABLE {$prefix}surveys";
     // $query[] = "DROP TABLE {$prefix}survey_questions";
     // $query[] = "DROP TABLE {$prefix}survey_templates";
     $this->db->StartTransaction();
     require_once 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("Unable to install addon, query failed: " . $query);
         }
     }
     try {
         $status = parent::Uninstall();
     } catch (Interspire_Addons_Exception $e) {
         $this->db->RollbackTransaction();
         throw new Exception("Unable to uninstall addon {$this->GetId}();" . $e->getMessage());
     }
     $this->db->CommitTransaction();
     return true;
 }