RU EN
Get started

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.

Terminal
./create                          # help

Module

Terminal
./create module blog

Creates a module with an index controller — the page is immediately available at /blog:

Result
site/modules/blog/
├── controllers/indexController.php   # class BlogIndexController, indexAction()
└── views/index.php                   # placeholder template

Controller

Terminal
./create controller blog post

Adds a BlogPostController with an indexAction() and a matching template to an existing module:

Result
site/modules/blog/controllers/postController.php
site/modules/blog/views/post.php
site/modules/blog/controllers/postController.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

Terminal
./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

Terminal
./create ramdrive 64M

Mounts 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:

site/cron/send_emails.php
<?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.