本文整理汇总了PHP中Core::delete_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::delete_cache方法的具体用法?PHP Core::delete_cache怎么用?PHP Core::delete_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::delete_cache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_saveorder
/**
* saves the category in a specific order and change the parent
* @return void
*/
public function action_saveorder()
{
$this->auto_render = FALSE;
$this->template = View::factory('js');
if (Menu::change_order(Core::get('order'))) {
Core::delete_cache();
$this->template->content = __('Saved');
} else {
$this->template->content = __('Error');
}
}
示例2: action_cache
public function action_cache()
{
$this->template->title = __('Cache');
Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title));
$cache_config = Core::config('cache.' . Core::config('cache.default'));
//force clean cache
if (Core::get('force') == 1) {
Core::delete_cache();
Alert::set(Alert::SUCCESS, __('All cache deleted'));
} elseif (Core::get('force') == 2) {
Cache::instance()->garbage_collect();
Theme::delete_minified();
Alert::set(Alert::SUCCESS, __('Deleted expired cache'));
}
$this->template->content = View::factory('oc-panel/pages/tools/cache', array('cache_config' => $cache_config));
}
示例3: action_index
public function action_index()
{
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Interactive map')));
$this->template->title = __('Interactive map');
$this->template->styles = array('css/map-generator.css' => 'screen');
$this->template->scripts['footer'][] = '//www.google.com/jsapi';
$this->template->scripts['footer'][] = '//maps.google.com/maps/api/js?sensor=false';
$this->template->scripts['footer'][] = 'js/oc-panel/map/jscolor.js';
$this->template->scripts['footer'][] = 'js/oc-panel/map/map-generator.js';
$map_active = Core::post('map_active', Core::Config('appearance.map_active'));
$map_settings = Core::post('current_settings', Core::Config('appearance.map_settings'));
// change map
if (Theme::get('premium') == 1 and Core::post('jscode')) {
Model_Config::set_value('appearance', 'map_active', Core::post('map_active'));
Model_Config::set_value('appearance', 'map_settings', Core::post('current_settings'));
Model_Config::set_value('appearance', 'map_jscode', Kohana::$_POST_ORIG['jscode']);
Core::delete_cache();
Alert::set(Alert::SUCCESS, __('Map saved.'));
}
$this->template->content = View::factory('oc-panel/pages/map', array('map_active' => $map_active, 'map_settings' => $map_settings));
}
示例4: action_update
public function action_update()
{
$name = $this->request->param('id');
$field = new Model_UserField();
$field_data = $field->get($name);
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit') . ' ' . $name));
$this->template->title = __('Edit Custom Field for Advertisement');
if ($_POST) {
try {
$options = array('label' => Core::post('label'), 'tooltip' => Core::post('tooltip'), 'required' => Core::post('required') == 'on' ? TRUE : FALSE, 'searchable' => Core::post('searchable') == 'on' ? TRUE : FALSE, 'show_profile' => Core::post('show_profile') == 'on' ? TRUE : FALSE, 'show_register' => Core::post('show_register') == 'on' ? TRUE : FALSE, 'admin_privilege' => Core::post('admin_privilege') == 'on' ? TRUE : FALSE);
if ($field->update($name, Core::post('values'), $options)) {
Core::delete_cache();
Alert::set(Alert::SUCCESS, sprintf(__('Field %s edited'), $name));
} else {
Alert::set(Alert::ERROR, sprintf(__('Field %s cannot be edited'), $name));
}
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'userfields', 'action' => 'index')));
}
$this->template->content = View::factory('oc-panel/pages/userfields/update', array('field_data' => $field_data, 'name' => $name));
}
示例5: action_delete_all
/**
* deletes all the locations
* @return void
*/
public function action_delete_all()
{
if (core::post('confirmation')) {
//delete location icons
$locations = new Model_Location();
if ($id_location = intval(Core::post('id_location')) and $id_location > 0) {
$selected_location = new Model_Location($id_location);
$locations->where('id_location', 'in', $selected_location->get_siblings_ids())->where('id_location', '!=', $selected_location->id_location);
} else {
$locations->where('id_location', '!=', '1')->find_all();
}
$locations = $locations->find_all();
foreach ($locations as $location) {
$root = DOCROOT . 'images/locations/';
//root folder
if (is_dir($root)) {
@unlink($root . $location->seoname . '.png');
// delete icon from Amazon S3
if (core::config('image.aws_s3_active')) {
$s3->deleteObject(core::config('image.aws_s3_bucket'), 'images/locations/' . $location->seoname . '.png');
}
}
}
$query_update = DB::update('ads');
$query_delete = DB::delete('locations');
if ($id_location = intval(Core::post('id_location')) and $id_location > 0) {
$query_update->set(array('id_location' => $selected_location->id_location));
$query_delete->where('id_location', 'in', $selected_location->get_siblings_ids())->where('id_location', '!=', $selected_location->id_location);
} else {
$query_update->set(array('id_location' => '1'));
$query_delete->where('id_location', '!=', '1');
}
$query_update->execute();
$query_delete->execute();
Core::delete_cache();
Alert::set(Alert::SUCCESS, __('All locations were deleted.'));
} else {
Alert::set(Alert::ERROR, __('You did not confirmed your delete action.'));
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'location', 'action' => 'index')));
}
示例6: action_deep
/**
* recalculating the deep of all the categories
* @return [type] [description]
*/
public function action_deep()
{
Core::delete_cache();
//getting all the cats as array
$cats_arr = Model_Category::get_as_array();
$cats = new Model_Category();
$cats = $cats->order_by('order', 'asc')->find_all()->cached()->as_array('id_category');
foreach ($cats as $cat) {
$deep = 0;
//getin the parent of this category
$id_category_parent = $cats_arr[$cat->id_category]['id_category_parent'];
//counting till we find the begining
while ($id_category_parent != 1 and $id_category_parent != 0 and $deep < 10) {
$id_category_parent = $cats_arr[$id_category_parent]['id_category_parent'];
$deep++;
}
//saving the category only if different deep
if ($cat->parent_deep != $deep) {
$cat->parent_deep = $deep;
$cat->save();
}
}
//Alert::set(Alert::INFO, __('Success'));
//HTTP::redirect(Route::url('oc-panel',array('controller' => 'location','action'=>'index')));
}
示例7: action_subscribe
public function action_subscribe()
{
$this->auto_render = FALSE;
// Update subscribe config action
Model_Config::set_value('general', 'subscribe', 1);
Core::delete_cache();
die('OK');
}
示例8: action_import_tool
public function action_import_tool()
{
$this->template->title = __('Import tool for locations and categories');
Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title));
//sending a CSV
if ($_POST) {
foreach ($_FILES as $file => $path) {
$csv = $path["tmp_name"];
$csv_2[] = $file;
if ($path['size'] > 1048576) {
Alert::set(Alert::ERROR, __('1 MB file'));
$this->redirect(Route::url('oc-panel', array('controller' => 'tools', 'action' => 'import_tool')));
}
if ($file == 'csv_file_categories' and $csv != FALSE) {
$expected_header = array('name', 'category_parent', 'price');
$cat_array = Core::csv_to_array($csv, $expected_header);
if (count($cat_array) > 10000) {
Alert::set(Alert::ERROR, __('limited to 10.000 at a time'));
$this->redirect(Route::url('oc-panel', array('controller' => 'tools', 'action' => 'import_tool')));
}
if ($cat_array === FALSE) {
Alert::set(Alert::ERROR, __('Something went wrong, please check format of the file! Remove single quotes or strange characters, in case you have any.'));
} else {
foreach ($cat_array as $cat) {
//category parent was sent?
if ($cat[1]) {
$category_parent = new Model_Category();
$category_parent->where('name', '=', $cat[1])->limit(1)->find();
if ($category_parent->loaded()) {
$cat[1] = $category_parent->id_category;
} else {
$cat[1] = 1;
}
} else {
$cat[1] = 1;
}
Model_Category::create_name($cat[0], 0, $cat[1], 0, $cat[2]);
}
Core::delete_cache();
Alert::set(Alert::SUCCESS, __('Categories successfully imported.'));
}
} elseif ($file == 'csv_file_locations' and $csv != FALSE) {
$expected_header = array('name', 'location_parent', 'latitude', 'longitude');
$loc_array = Core::csv_to_array($csv, $expected_header);
if (count($loc_array) > 10000) {
Alert::set(Alert::ERROR, __('limited to 10.000 at a time'));
$this->redirect(Route::url('oc-panel', array('controller' => 'tools', 'action' => 'import_tool')));
}
if ($loc_array === FALSE) {
Alert::set(Alert::ERROR, __('Something went wrong, please check format of the file! Remove single quotes or strange characters, in case you have any.'));
} else {
foreach ($loc_array as $loc) {
//location parent was sent?
if ($loc[1]) {
$location_parent = new Model_Location();
$location_parent->where('name', '=', $loc[1])->limit(1)->find();
if ($location_parent->loaded()) {
$loc[1] = $location_parent->id_location;
} else {
$loc[1] = 1;
}
} else {
$loc[1] = 1;
}
Model_Location::create_name($loc[0], 0, $loc[1], 0, $loc[2], $loc[3]);
}
Core::delete_cache();
Alert::set(Alert::SUCCESS, __('Locations successfully imported.'));
}
}
}
}
$this->template->content = View::factory('oc-panel/pages/tools/import_tool');
}
示例9: action_saveorder
/**
* saves the content in a specific order
* @return void
*/
public function action_saveorder()
{
$this->auto_render = FALSE;
$this->template = View::factory('js');
$locale = core::get('locale_select', core::config('i18n.locale'));
if ($contents = Model_Content::get_contents(core::get('type'), $locale)) {
$order = Core::get('order');
//using order they send us
foreach ($order as $key => $value) {
$c = new Model_Content($value);
$c->order = $key;
$c->save();
}
Core::delete_cache();
$this->template->content = __('Saved');
} else {
$this->template->content = __('Error');
}
}
示例10: action_multy_categories
/**
* Creates multiple categories just with name
* @return void
*/
public function action_multy_categories()
{
$this->auto_render = FALSE;
//update the elements related to that ad
if ($_POST) {
// d($_POST);
if (core::post('multy_categories') !== "") {
$multy_cats = explode(',', core::post('multy_categories'));
$obj_category = new Model_Category();
$insert = DB::insert('categories', array('name', 'seoname', 'id_category_parent'));
foreach ($multy_cats as $name) {
$insert = $insert->values(array($name, $obj_category->gen_seoname($name), 1));
}
// Insert everything with one query.
$insert->execute();
Core::delete_cache();
} else {
Alert::set(Alert::INFO, __('Select some categories first.'));
}
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'category', 'action' => 'index')));
}
示例11: action_geonames_locations
/**
* Import multiple locations from geonames
* @return void
*/
public function action_geonames_locations()
{
$this->auto_render = FALSE;
//update the elements related to that ad
if (core::post('geonames_locations') !== "") {
$geonames_locations = json_decode(core::post('geonames_locations'));
if (count($geonames_locations) > 0) {
$obj_location = new Model_Location();
$locations_array = array();
$insert = DB::insert('locations', array('name', 'seoname', 'id_location_parent', 'latitude', 'longitude'));
foreach ($geonames_locations as $location) {
if (!in_array($location->name, $locations_array)) {
$insert = $insert->values(array($location->name, $obj_location->gen_seoname($location->name), Core::get('id_location', 1), isset($location->lat) ? $location->lat : NULL, isset($location->long) ? $location->long : NULL));
$locations_array[] = $location->name;
}
}
// Insert everything with one query.
$insert->execute();
Core::delete_cache();
}
} else {
Alert::set(Alert::INFO, __('Select some locations first.'));
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'location', 'action' => 'index')) . '?id_location=' . Core::get('id_location', 1));
}
示例12: action_themes
/**
* STEP 4 and last
* updates all themes to latest version from API license
* @return void
*/
public function action_themes()
{
$licenses = array();
//getting the licenses unique. to avoid downloading twice
$themes = core::config('theme');
foreach ($themes as $theme) {
$settings = json_decode($theme, TRUE);
if (isset($settings['license'])) {
if (!in_array($settings['license'], $licenses)) {
$licenses[] = $settings['license'];
}
}
}
//only if theres work to do ;)
if (count($licenses) > 0) {
//activate maintenance mode
Model_Config::set_value('general', 'maintenance', 1);
//for each unique license then download!
foreach ($licenses as $license) {
Theme::download($license);
}
Alert::set(Alert::SUCCESS, __('Themes Updated'));
//deactivate maintenance mode
Model_Config::set_value('general', 'maintenance', 0);
//clean cache
Core::delete_cache();
}
//finished the entire update process
$this->redirect(Route::url('oc-panel', array('controller' => 'update', 'action' => 'index')));
}
示例13: action_template
//.........这里部分代码省略.........
"name": "age",
"type": "integer",
"label": "Age",
"tooltip": "Age",
"required": false,
"searchable": true,
"admin_privilege": false,
"show_listing": true,
"values": ""
},
{
"name": "body",
"type": "select",
"label": "Body",
"tooltip": "Body",
"required": false,
"searchable": true,
"admin_privilege": false,
"show_listing": true,
"values": "-,Athletic,Average,big,Curvy,Fit,Heavy,HWP,Skinny,Thin,"
},
{
"name": "height",
"type": "select",
"label": "Height",
"tooltip": "Height",
"required": false,
"searchable": true,
"admin_privilege": false,
"show_listing": true,
"values": "Taller than 6.8 (203 cm),6.7 (200 cm),6.6 (198 cm),6.5 (195 cm),6.4 (194cm),6.3 (190 cm),6.2 (187 cm),6.1 (185 cm),6.0 (182 cm),5.11 (180 cm),5.10 (177 cm),5.9 (175 cm),5.8 (172 cm),5.7 (170 cm),5.6 (167 cm),5.5 (165 cm),5.4 (162 cm),5.3 (160 cm),5.2 (157 cm),5.1 (154 cm),5.0 (152 cm),4.11 (150 cm),4.10 (147 cm),4.9 (145 cm),4.8 (142 cm) or less"
},
{
"name": "status",
"type": "select",
"label": "Status",
"tooltip": "Status",
"required": false,
"searchable": true,
"admin_privilege": false,
"show_listing": false,
"values": "Single,In a Relationship,Engaged,Married,Separated,Divorced,Widowed"
},
{
"name": "occupation",
"type": "string",
"label": "Occupation",
"tooltip": "Occupation",
"required": false,
"searchable": true,
"admin_privilege": false,
"show_listing": false,
"values": ""
},
{
"name": "hair",
"type": "string",
"label": "Hair",
"tooltip": "Hair",
"required": false,
"searchable": true,
"admin_privilege": false,
"show_listing": false,
"values": ""
},
{
"name": "eye-color",
"type": "string",
"label": "Eye color",
"tooltip": "Eye color",
"required": false,
"searchable": true,
"admin_privilege": false,
"show_listing": false,
"values": ""
}
]
}
';
$cf_templates = json_decode($cf_templates, TRUE);
$field = new Model_Field();
foreach ($cf_templates[Core::post('type')] as $custom_field) {
try {
$name = $custom_field['name'];
$options = array('label' => $custom_field['label'], 'tooltip' => $custom_field['tooltip'], 'required' => $custom_field['required'], 'searchable' => $custom_field['searchable'], 'admin_privilege' => $custom_field['admin_privilege'], 'show_listing' => $custom_field['show_listing']);
if ($field->create($name, $custom_field['type'], $custom_field['values'], Core::post('categories'), $options)) {
Core::delete_cache();
Alert::set(Alert::SUCCESS, sprintf(__('Field %s created'), $name));
} else {
Alert::set(Alert::ERROR, sprintf(__('Field %s already exists'), $name));
}
} catch (Exception $e) {
throw HTTP_Exception::factory(500, $e->getMessage());
}
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'fields', 'action' => 'index')));
} else {
HTTP::redirect(Route::url('oc-panel', array('controller' => 'fields', 'action' => 'index')));
}
}
示例14: action_delete
/**
* CRUD controller: DELETE
*/
public function action_delete()
{
$this->auto_render = FALSE;
$forum = new Model_Forum($this->request->param('id'));
//update the elements related to that ad
if ($forum->loaded()) {
try {
$forum->delete();
$this->template->content = 'OK';
Core::delete_cache();
Alert::set(Alert::SUCCESS, __('Forum deleted'));
} catch (Exception $e) {
Alert::set(Alert::ERROR, $e->getMessage());
}
} else {
Alert::set(Alert::ERROR, __('Forum not deleted'));
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'forum', 'action' => 'index')));
}
示例15: action_delete_all
/**
* deletes all the categories
* @return void
*/
public function action_delete_all()
{
if (core::post('confirmation')) {
//delete categories icons
$categories = new Model_Category();
$categories = $categories->where('id_category', '!=', '1')->find_all();
foreach ($categories as $category) {
$root = DOCROOT . 'images/categories/';
//root folder
if (is_dir($root)) {
@unlink($root . $category->seoname . '.png');
// delete icon from Amazon S3
if (core::config('image.aws_s3_active')) {
$s3->deleteObject(core::config('image.aws_s3_bucket'), 'images/categories/' . $category->seoname . '.png');
}
}
}
//set home category to all the ads
$query = DB::update('ads')->set(array('id_category' => '1'))->execute();
//delete all categories
$query = DB::delete('categories')->where('id_category', '!=', '1')->execute();
Core::delete_cache();
Alert::set(Alert::SUCCESS, __('All categories were deleted.'));
} else {
Alert::set(Alert::ERROR, __('You did not confirmed your delete action.'));
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'category', 'action' => 'index')));
}