Documentation Tools
The ./create console
Generate modules, controllers, migrations and a RAM drive with a single command.
./create is a console utility for routine operations. The install script creates a link
create → olala/console/create in the site root; run it from the site root. It requires PHP CLI at /usr/bin/php.
./create # helpModule
./create module blogCreates a module with an index controller — the page is immediately available at /blog:
site/modules/blog/
├── controllers/indexController.php # class BlogIndexController, indexAction()
└── views/index.php # placeholder templateController
./create controller blog postAdds a BlogPostController with an indexAction() and a matching template to an existing module:
site/modules/blog/controllers/postController.php
site/modules/blog/views/post.php<?php
use olala\controller;
class BlogPostController extends controller {
function indexAction() {
return $this->render("post");
}
}The module must already exist — run ./create module first. Existing files with the same names are overwritten without asking.
Migration
./create db add_posts
Creates the file site/db/upgrades/db_up{time}_add_posts.php with the functions …_up() and …_down(),
which return the SQL to apply and roll back. The site/db/upgrades folder must exist.
See Models and database for details.
RAM drive for the cache
./create ramdrive 64MMounts the ./cache folder as tmpfs of the given size (64M, 1G…). Requires sudo rights. See Cache for details.
Your own console scripts
Background jobs (mailings, imports, statistics) are easy to write as standalone PHP scripts that boot the core without handling a request:
<?php
// run: php site/cron/send_emails.php
chdir(__DIR__ . '/../..'); // the site root — autoloading works from here
include 'olala/kernel.php';
olala\kernel::init();
require 'config.php';
olala\modules\email::backgroundSender();The built-in script olala/console/visitors_stat.php, which counts visitors from the web server log, works the same way.