X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FSample%2FSamplePlugin.php;h=a0d1140f3725b77512fc54057df3000e89b3962c;hb=f82dd4e14f8e4797f2a14cf10527bb71bc224b72;hp=913741226b4302cd2c63bc09f439659fe9a89d68;hpb=a180658a3bfcf2b7b312058e3aa76e0e2467c2f8;p=quix0rs-gnu-social.git diff --git a/plugins/Sample/SamplePlugin.php b/plugins/Sample/SamplePlugin.php index 913741226b..a0d1140f37 100644 --- a/plugins/Sample/SamplePlugin.php +++ b/plugins/Sample/SamplePlugin.php @@ -101,7 +101,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - class SamplePlugin extends Plugin { /** @@ -129,7 +128,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function initialize() { return true; @@ -143,7 +141,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function cleanup() { return true; @@ -168,7 +165,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onCheckSchema() { $schema = Schema::get(); @@ -176,9 +172,20 @@ class SamplePlugin extends Plugin // For storing user-submitted flags on profiles $schema->ensureTable('user_greeting_count', - array(new ColumnDef('user_id', 'integer', null, - true, 'PRI'), - new ColumnDef('greeting_count', 'integer'))); + array( + 'fields' => array( + 'user_id' => array('type' => 'int', 'not null' => true), + 'greeting_count' => array('type' => 'int'), + ), + 'primary key' => array('user_id'), + 'foreign keys' => array( + // Not all databases will support foreign keys, but even + // when not enforced it's helpful to include these definitions + // as documentation. + 'user_greeting_count_user_id_fkey' => array('user', array('user_id' => 'id')), + ), + ) + ); return true; } @@ -201,7 +208,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onAutoload($cls) { $dir = dirname(__FILE__); @@ -231,7 +237,6 @@ class SamplePlugin extends Plugin * * @return boolean hook value; true means continue processing, false means stop. */ - function onRouterInitialized($m) { $m->connect('main/hello', @@ -256,7 +261,6 @@ class SamplePlugin extends Plugin * * @see Action */ - function onEndPrimaryNav($action) { // common_local_url() gets the correct URL for the action name @@ -278,4 +282,3 @@ class SamplePlugin extends Plugin return true; } } -