Skip to content

Commit

Permalink
Zing plugin class
Browse files Browse the repository at this point in the history
  • Loading branch information
jaz303 committed Mar 14, 2011
1 parent 51e3f64 commit 799eb9c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
16 changes: 16 additions & 0 deletions db/migrations/1_create_lfo_table.php
@@ -0,0 +1,16 @@
<?php
class CreateLfoTable extends zing\db\Migration
{
public function up() {
$this->create_table('lfo_object', function($t) {
$t->string('__object_class', array('null' => false));
$t->string('__serialized_format', array('limit' => 20, 'null' => false));
$t->text('__serialized_data', array('null' => false, 'mysql.size' => 'long'));
});
}

public function down() {
$this->drop_table('lfo_object');
}
}
?>
18 changes: 18 additions & 0 deletions zing/plugin.php
Expand Up @@ -3,5 +3,23 @@

class ZingPlugin extends \zing\plugin\Plugin
{
public function post_install() {

$source = <<<SOURCE
function lfo_configure() {
\\lfo\\Gateway::configure(function(\$g) use (\$link) {
\$db = GDB::instance();
\$g->mysql_link = \$db->get_mysql_link();
\$g->table_name = 'lfo_object';
});
}
SOURCE;

\zing\sys\SourceBlockWriter::append_block_to_file(
ZING_CONFIG_DIR . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'main.php',
'plugin.jaz303.little-fat-objects',
$source
);
}
}
?>

0 comments on commit 799eb9c

Please sign in to comment.