Elgg  Version master
reset.php
Go to the documentation of this file.
1 <?php
6 $guid = (int) get_input('guid');
7 
9 if (!$entity instanceof ElggUpgrade) {
10  return elgg_error_response(elgg_echo('error:missing_data'));
11 }
12 
13 if (!$entity->canEdit()) {
14  return elgg_error_response(elgg_echo('actionunauthorized'));
15 }
16 
17 $entity->reset();
18 
19 return elgg_ok_response('', elgg_echo('admin:action:upgrade:reset:success', [$entity->getDisplayName()]));
elgg_ok_response($content= '', string|array $message= '', string $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_error_response(string|array $message= '', string $forward_url=REFERRER, int $status_code=ELGG_HTTP_BAD_REQUEST)
Prepare an error response to be returned by a page or an action handler.
$entity
Definition: reset.php:8
get_entity(int $guid)
Loads and returns an entity object from a guid.
Definition: entities.php:70
Represents an upgrade that runs outside of the upgrade.php script.
Definition: ElggUpgrade.php:26
$guid
Reset an ElggUpgrade.
Definition: reset.php:6