<commit_before><?php
/**
 * Example Activation
 *
 * Activation class for Example plugin.
 * This is optional, and is required only if you want to perform tasks when your plugin is activated/deactivated.
 *
 * @package  Croogo
 * @author   <NAME> <<EMAIL>>
 * @license  http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link     http://www.croogo.org
 */
class GalleryActivation {
/**
 * onActivate will be called if this returns true
 *
 * @param  object $controller Controller
 * @return boolean
 */
    public function beforeActivation(&$controller) {
		$sql = file_get_contents(APP.'plugins'.DS.'gallery'.DS.'config'.DS.'gallery.sql');
		if (!empty($sql)) {
			App::import('Core', 'File');
			App::import('Model', 'ConnectionManager');
			$db = ConnectionManager::getDataSource('default');

			$statements = explode(';', $sql);

			foreach ($statements as $statement) {
				if (trim($statement) != '') {
					$db->query($statement);
				}
			}
		}
		return true;
	}

/**
 * Called after activating the plugin in ExtensionsPluginsController::admin_toggle()
 *
 * @param object $controller Controller
 * @return void
 */
    public function onActivation(&$controller) {
        // ACL: set ACOs with permissions
		$controller->Croogo->addAco('Gallery/Albums');
        $controller->Croogo->addAco('Gallery/Albums/index', array('registered', 'public'));
        $controller->Croogo->addAco('Gallery/Albums/view', array('registered', 'public'));
        $controller->Croogo->addAco('Gallery/Albums/admin_index', array('admin'));
		$controller->Croogo->addAco('Gallery/Albums/admin_add', array('admin'));
		$controller->Croogo->addAco('Gallery/Albums/admin_edit', array('admin'));
		$controller->Croogo->addAco('Gallery/Photos');
		$controller->Croogo->addAco('Gallery/Photos/admin_upload', array('admin','public','registered'));




		$controller->Setting->write('Gallery.album_limit_pagination', '10', array('editable' => 1, 'title' => 'Albums Per Page'));
		$controller->Setting->write('Gallery.max_width', '500', array('editable' => 1));
    	$controller->Setting->write('Gallery.max_width_thumb', '120', array('editable' => 1));
    	$controller->Setting->write('Gallery.max_height_thumb', '80', array('editable' => 1));
    	$controller->Setting->write('Gallery.quality', '90', array('editable' => '1'));
		$controller->Setting->write('Gallery.jslibs', 'galleria,nivo-slider,DDSlider', array('editable' => '1'));
    }

/**
 * onDeactivate will be called if this returns true
 *
 * @param  object $controller Controller
 * @return boolean
 */
    public function beforeDeactivation(&$controller) {
		$sql = file_get_contents(APP.'plugins'.DS.'gallery'.DS.'config'.DS.'gallery_deactivate.sql');
		if (!empty($sql)) {
			App::import('Core', 'File');
			App::import('Model', 'ConnectionManager');
			$db = ConnectionManager::getDataSource('default');
			$statements = explode(';', $sql);

			foreach ($statements as $statement) {
				if (trim($statement) != '') {
					$db->query($statement);
				}
			}
		}
        return true;
    }

/**
 * Called after deactivating the plugin in ExtensionsPluginsController::admin_toggle()
 *
 * @param object $controller Controller
 * @return void
 */
    public function onDeactivation(&$controller) {
        $controller->Croogo->removeAco('Gallery');

		$controller->Setting->deleteKey('Gallery.album_limit_pagination');
		$controller->Setting->deleteKey('Gallery.max_width');
    	$controller->Setting->deleteKey('Gallery.max_width_thumb');<commit_msg>remove obsolete methods since we're using schema<commit_after><?php
/**
 * Example Activation
 *
 * Activation class for Example plugin.
 * This is optional, and is required only if you want to perform tasks when your plugin is activated/deactivated.
 *
 * @package  Croogo
 * @author   <NAME> <<EMAIL>>
 * @license  http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link     http://www.croogo.org
 */
class GalleryActivation {

/**
 * Called after activating the plugin in ExtensionsPluginsController::admin_toggle()
 *
 * @param object $controller Controller
 * @return void
 */
    public function onActivation(&$controller) {
        // ACL: set ACOs with permissions
		$controller->Croogo->addAco('Gallery/Albums');
        $controller->Croogo->addAco('Gallery/Albums/index', array('registered', 'public'));
        $controller->Croogo->addAco('Gallery/Albums/view', array('registered', 'public'));
        $controller->Croogo->addAco('Gallery/Albums/admin_index', array('admin'));
		$controller->Croogo->addAco('Gallery/Albums/admin_add', array('admin'));
		$controller->Croogo->addAco('Gallery/Albums/admin_edit', array('admin'));
		$controller->Croogo->addAco('Gallery/Photos');
		$controller->Croogo->addAco('Gallery/Photos/admin_upload', array('admin','public','registered'));




		$controller->Setting->write('Gallery.album_limit_pagination', '10', array('editable' => 1, 'title' => 'Albums Per Page'));
		$controller->Setting->write('Gallery.max_width', '500', array('editable' => 1));
    	$controller->Setting->write('Gallery.max_width_thumb', '120', array('editable' => 1));
    	$controller->Setting->write('Gallery.max_height_thumb', '80', array('editable' => 1));
    	$controller->Setting->write('Gallery.quality', '90', array('editable' => '1'));
		$controller->Setting->write('Gallery.jslibs', 'galleria,nivo-slider,DDSlider', array('editable' => '1'));
    }

/**
 * Called after deactivating the plugin in ExtensionsPluginsController::admin_toggle()
 *
 * @param object $controller Controller
 * @return void
 */
    public function onDeactivation(&$controller) {
        $controller->Croogo->removeAco('Gallery');

		$controller->Setting->deleteKey('Gallery.album_limit_pagination');
		$controller->Setting->deleteKey('Gallery.max_width');
    	$controller->Setting->deleteKey('Gallery.max_width_thumb');
{'fraction_non_alphanumeric': 0.1787966592807227, 'fraction_numerical': 0.006136014999147775, 'mean_word_length': 4.891566265060241, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1182440', 'n_tokens_mistral': 1927, 'n_tokens_neox': 1757, 'n_words': 333}