/** * Invalidate the persistence layer only after a successful compile of the * LESS files. * * @param array $variables LESS variable array to use * @param boolean $update_persistence Whether the persist successful compile * * @return boolean Whether successful */ public function invalidate_cache(array $variables = null, $update_persistence = false) { $notification = $this->_registry->get('notification.admin'); try { // Try to parse the css $css = $this->lessphp_controller->parse_less_files($variables); // Reset the parse time to force a browser reload of the CSS, whether we are // updating persistence or not. Do it here to be sure files compile ok. $this->save_less_parse_time(); if ($update_persistence) { $this->update_persistence_layer($css); } else { $this->persistance_context->delete_data_from_persistence(); } } catch (Ai1ec_Cache_Write_Exception $e) { // This means successful during parsing but problems persisting the CSS. $message = '<p>' . Ai1ec_I18n::__("The LESS file compiled correctly but there was an error while saving the generated CSS to persistence.") . '</p>'; $notification->store($message, 'error'); return false; } catch (Exception $e) { // An error from lessphp. $message = sprintf(Ai1ec_I18n::__('<p><strong>There was an error while compiling CSS.</strong> The message returned was: <em>%s</em></p>'), $e->getMessage()); $notification->store($message, 'error', 1); return false; } return true; }
/** * Invalidate the persistence layer only after a successful compile of the * LESS files. * * @param array $variables LESS variable array to use * @param boolean $update_persistence Whether the persist successful compile * * @return boolean Whether successful */ public function invalidate_cache(array $variables = null, $update_persistence = false) { if (!$this->lessphp_controller->is_compilation_needed($variables)) { $this->_registry->get('model.option')->delete('ai1ec_render_css'); return true; } $notification = $this->_registry->get('notification.admin'); if (!$this->_registry->get('compatibility.memory')->check_available_memory(AI1EC_LESS_MIN_AVAIL_MEMORY)) { $message = sprintf(Ai1ec_I18n::__('CSS compilation failed because you don\'t have enough free memory (a minimum of %s is needed). Your calendar will not render or function properly without CSS. Please read <a href="http://time.ly/document/user-guide/getting-started/pre-sale-questions/">this article</a> to learn how to increase your PHP memory limit.'), AI1EC_LESS_MIN_AVAIL_MEMORY); $notification->store($message, 'error', 1, array(Ai1ec_Notification_Admin::RCPT_ADMIN), true); return; } try { // Try to parse the css $css = $this->lessphp_controller->parse_less_files($variables); // Reset the parse time to force a browser reload of the CSS, whether we are // updating persistence or not. Do it here to be sure files compile ok. $this->save_less_parse_time(); if ($update_persistence) { $this->update_persistence_layer($css); } else { $this->persistance_context->delete_data_from_persistence(); } } catch (Ai1ec_Cache_Write_Exception $e) { // This means successful during parsing but problems persisting the CSS. $message = '<p>' . Ai1ec_I18n::__("The LESS file compiled correctly but there was an error while saving the generated CSS to persistence.") . '</p>'; $notification->store($message, 'error'); return false; } catch (Exception $e) { // An error from lessphp. $message = sprintf(Ai1ec_I18n::__('<p><strong>There was an error while compiling CSS.</strong> The message returned was: <em>%s</em></p>'), $e->getMessage()); $notification->store($message, 'error', 1); return false; } return true; }
/** * Clears Facebook data from Session, clear the Access token and disable cron functions * */ private function clear_facebook_data_from_session_and_db_and_disable_cron() { // Get an instance of the Facebook class $facebook = $this->facebook_instance_factory(); // Destroy the session so that no Facebook data is held $facebook->destroySession(); // Invalidate the Token $this->save_plugin_variable(self::FB_TOKEN, ''); // Delete all data from the facebook users table otherwise if a different user logs in data is mixed $this->clean_facebook_users_table_on_logout(); // Delete the user saved in session $this->persistance_context->delete_data_from_persistence(); // Disable the cron Functions $this->disable_cron_functions(); // Delete the option that saves the cron version: when a new acces token is obtained the CRON will be set again delete_option(self::FB_OPTION_CRON_VERSION); }