Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add database table.

  • Loading branch information...
commit 00213924d01f546418d719c3e7e6bc990e84d68f 1 parent bba3dd2
@halfdan authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 FeedAnnotation.php
View
33 FeedAnnotation.php
@@ -34,6 +34,36 @@ 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(
@@ -41,6 +71,9 @@ public function getListHooksRegistered()
);
}
+ /**
+ * Add new "Feed Annotations" admin menu.
+ */
public function addAdminMenu() {
Piwik_AddAdminSubMenu('General_Settings', 'FeedAnnotation_MenuGeneralSettings',
array('module' => 'FeedAnnotation', 'action' => 'index'),
Please sign in to comment.
Something went wrong with that request. Please try again.