Skip to content

Commit

Permalink
Add database table.
Browse files Browse the repository at this point in the history
  • Loading branch information
halfdan committed Feb 27, 2013
1 parent bba3dd2 commit 0021392
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions FeedAnnotation.php
Expand Up @@ -34,13 +34,46 @@ public function getInformation()
'translationAvailable' => true,
);
}

/**
* Create required FeedAnnotation database table
*
* @throws Exception
*/
public function install() {
$tableFeedAnnotation = "CREATE TABLE " . Piwik_Common::prefixTable("feedannotation") . " (
idfeed INT NOT NULL AUTO_INCREMENT,
idsite INT(11) NOT NULL,
feed_url VARCHAR(200) NOT NULL,
PRIMARY KEY (idfeed)
) DEFAULT CHARSET=utf8;";

try {
Piwik_Exec($tableFeedAnnotation);
} catch (Exception $e) {
// mysql code error 1050:table already exists
// see bug #153 http://dev.piwik.org/trac/ticket/153
if (!Zend_Registry::get('db')->isErrNo($e, '1050')) {
throw $e;
}
}
}

/**
* Return the registered hooks
*
* @return array
*/
public function getListHooksRegistered()
{
return array(
'AdminMenu.add' => 'addAdminMenu'
);
}

/**
* Add new "Feed Annotations" admin menu.
*/
public function addAdminMenu() {
Piwik_AddAdminSubMenu('General_Settings', 'FeedAnnotation_MenuGeneralSettings',
array('module' => 'FeedAnnotation', 'action' => 'index'),
Expand Down

0 comments on commit 0021392

Please sign in to comment.