2017 © Pedro Peláez
 

cakephp-plugin apps

CakePHP Apps Plugin

image

gilleswittenberg/apps

CakePHP Apps Plugin

  • Sunday, November 3, 2013
  • by gilleswittenberg
  • Repository
  • 1 Watchers
  • 1 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

CakePHP Apps plugin Build Status

CakePHP plugin to manage multiple applications, domains and databases running on same APP and CORE codebase., (*1)

Requirements

  • CakePHP 2.0+
  • PHP 5.3.0
  • This Plugin is written for Debian/Linux running Apache2 and MySQL

Installation

  • Install using Composer (https://packagist.org/packages/gilleswittenberg/apps)
    • add require: {"gilleswittenberg/apps": "dev-master"}
  • Install copying or cloning to Plugin/Apps
  • Add CakePlugin::load('Apps', array('bootstrap' => true, 'routes' => true)); to Config/bootstrap.php

Setup Debian

  • Install sudo (as root) apt-get install sudo
  • Add Apache user (www-data) to sudoers sudo adduser www-data sudo
  • Allow Apache user (www-data) to passwordless execute the following commands (apachectl, a2ensite, a2dissite)
    • run visudo
    • add www-data ALL = NOPASSWD: /usr/sbin/apachectl
    • add www-data ALL = NOPASSWD: /usr/sbin/a2ensite
    • add www-data ALL = NOPASSWD: /usr/sbin/a2dissite
  • Make sure {APACHE_DIR}/sites-available is writable by user running Apache (www-data)

Setup

  • Set database config for database Apps in Config/database.php
  • Run cake schema create -p Apps
  • Grant the user of database Apps the following privileges: create, drop, create user, grant user, new databases
  • Create dumpDir ({TMP} by default) and make sure it is writable by user running Apache (www-data)
  • Add all your document_roots at /apps/document_roots/
  • create dir {APP}/Config/applcations for all your document_roots
  • Append the following code to all document_root/{APP}/Config/bootstrap.php files
if (isset($_SERVER['SERVER_NAME'])) {
    $bootstrap = APP . Configure::read('Apps.configDir') . DS . $_SERVER['SERVER_NAME'] . '.php';
} elseif (count($_SERVER['argv'])) {
    $bootstrap = APP . Configure::read('Apps.configDir') . DS . 'current_application';
}
if (file_exists($bootstrap)) {
    require($bootstrap);
}
  • Add the following constructor method to all document_root/{APP}/Config/database.php DATABASE_CONFIG classes
public function __construct () {
    $config = Configure::read('Database.config');
    if (is_array($config)) {
        $this->default = $config['default'];
    }
}
  • Create your base schema.php and snapshots for each document_root and make sure the classname is AppSchema
  • Open /apps/applications/check_config in your browser and check for warnings
  • Create some apps at /apps/applications/add to see if everything is working fine

ToDo

  • Give Application.status titles instead of integers
  • Slim down privileges of database Apps user
  • Add counter-cache to DocumentRoot for applications

The Versions

03/11 2013

dev-master

9999999-dev https://github.com/gilleswittenberg/CakePHP_Apps

CakePHP Apps Plugin

  Sources   Download

MIT

The Requires