Restore prefix to proceed with ECS loop pengembalian akhiran

@return void
341868
public function restorePrefix()
    {
        foreach ($this->removals as $i => $removal) {
            if ($removal->getAffixType() == 'DP') {
                // return the word before precoding (the subject of first prefix removal)
                $this->setCurrentWord($removal->getSubject());
                break;
            }
        }

        foreach ($this->removals as $i => $removal) {
            if ($removal->getAffixType() == 'DP') {
                unset($this->removals[$i]);
            }
        }
    }
1169636
public function handleRequest(): void
	{
		global $save, $restore;

		$request = $this->getRequest();
		if ((!empty($save) || !empty($restore)) && $request->isPost() && check_bitrix_sessid()) {
			if (!empty($restore)) {
				// Restore defaults
				Option::delete(ADMIN_MODULE_NAME);
				CAdminMessage::showMessage([
					'MESSAGE' => Loc::getMessage('REFERENCES_OPTIONS_RESTORED'),
					'TYPE' => 'OK',
				]);
			} else {
				try {
					// Save options
					foreach ($this->options->getFields() as $id => $opt) {
						switch ($opt['type']) {
							case 'checkbox':
								$value = $request->getPost($id) ? true : false;
								break;

							case 'number':
								$value = (int)$request->getPost($id);
								break;

							case 'text':
							default:
								$value = $request->getPost($id);
								break;
						}

						$event = new Event(ADMIN_MODULE_NAME, 'OnBeforeSetOption_' . $id, ['value' => &$value]);
						$event->send();

						$event = new Event(ADMIN_MODULE_NAME, 'OnBeforeSetOption', ['value' => &$value, 'name' => $id]);
						$event->send();

						Option::set(ADMIN_MODULE_NAME, $id, $value);
					}

					$event = new Event(ADMIN_MODULE_NAME, 'OnAfterSaveOptions');
					$event->send();

					CAdminMessage::showMessage([
						'MESSAGE' => Loc::getMessage('REFERENCES_OPTIONS_SAVED'),
						'TYPE' => 'OK',
					]);
				} catch (\Exception $exception) {
					CAdminMessage::showMessage($exception->getMessage());
				}
			}
		}
	}
289727
private function restoreLastUserInput()
    {
        $this->userInput = $this->lastInput;
        $this->cursorPosition = mb_strlen($this->userInput);
    }
1060150
public function after_restore() {
        global $DB;

        // Get the blockid.
        $blockid = $this->get_blockid();

        // Extract block configdata and remove tag collection reference if this is another site. Also map contextid.
        if ($configdata = $DB->get_field('block_instances', 'configdata', array('id' => $blockid))) {
            $config = unserialize(base64_decode($configdata));
            $changed = false;
            if (!empty($config->tagcoll) && $config->tagcoll > 1 && !$this->is_samesite()) {
                $config->tagcoll = 0;
                $changed = true;
            }
            if (!empty($config->ctx)) {
                if ($ctxmap = restore_dbops::get_backup_ids_record($this->get_restoreid(), 'context', $config->ctx)) {
                    $config->ctx = $ctxmap->newitemid;
                } else {
                    $config->ctx = 0;
                }
                $changed = true;
            }
            if ($changed) {
                $configdata = base64_encode(serialize($config));
                $DB->set_field('block_instances', 'configdata', $configdata, array('id' => $blockid));
            }
        }
    }
740949
public static function reset() {
		static::$_singularized = static::$_pluralized = [];
		static::$_camelized = static::$_underscored = [];
		static::$_humanized = [];

		static::$_plural['regexUninflected'] = static::$_singular['regexUninflected'] = null;
		static::$_plural['regexIrregular'] = static::$_singular['regexIrregular'] = null;
		static::$_transliteration = [
			'/à|á|å|â/' => 'a',
			'/è|é|ê|ẽ|ë/' => 'e',
			'/ì|í|î/' => 'i',
			'/ò|ó|ô|ø/' => 'o',
			'/ù|ú|ů|û/' => 'u',
			'/ç|ć|č/' => 'c',
			'/đ/' => 'dj',
			'/š/' => 's',
			'/ž/' => 'z',
			'/ñ/' => 'n',
			'/ä|æ/' => 'ae',
			'/ö/' => 'oe',
			'/ü/' => 'ue',
			'/Ä/' => 'Ae',
			'/Ü/' => 'Ue',
			'/Ö/' => 'Oe',
			'/ß/' => 'ss',
			'/Č|Ć/' => 'C',
			'/DŽ/' => 'Dz',
			'/Đ/' => 'Dj',
			'/Š/' => 'S',
			'/Ž/' => 'Z'
		];
	}
519116
public function resetState()
	{
		parent::resetState();

		// clean temporary db
		$table_name = Config::get('laravel-import-export::baseconf.table_prefix');
		$connection_name = Config::get('laravel-import-export::baseconf.connection_name');
		DB::connection($connection_name)->table($table_name)->truncate();
	}
953958
public function on_root_element_end() {
        global $CFG;

        // restore the stashes prepared by other handlers for us
        $backupinfo         = $this->converter->get_stash('backup_info');
        $originalcourseinfo = $this->converter->get_stash('original_course_info');

        ////////////////////////////////////////////////////////////////////////
        // write moodle_backup.xml
        ////////////////////////////////////////////////////////////////////////
        $this->open_xml_writer('moodle_backup.xml');

        $this->xmlwriter->begin_tag('moodle_backup');
        $this->xmlwriter->begin_tag('information');

        // moodle_backup/information
        $this->xmlwriter->full_tag('name', $backupinfo['name']);
        $this->xmlwriter->full_tag('moodle_version', $backupinfo['moodle_version']);
        $this->xmlwriter->full_tag('moodle_release', $backupinfo['moodle_release']);
        $this->xmlwriter->full_tag('backup_version', $CFG->backup_version); // {@see restore_prechecks_helper::execute_prechecks}
        $this->xmlwriter->full_tag('backup_release', $CFG->backup_release);
        $this->xmlwriter->full_tag('backup_date', $backupinfo['date']);
        // see the commit c0543b - all backups created in 1.9 and later declare the
        // information or it is considered as false
        if (isset($backupinfo['mnet_remoteusers'])) {
            $this->xmlwriter->full_tag('mnet_remoteusers', $backupinfo['mnet_remoteusers']);
        } else {
            $this->xmlwriter->full_tag('mnet_remoteusers', false);
        }
        $this->xmlwriter->full_tag('original_wwwroot', $backupinfo['original_wwwroot']);
        // {@see backup_general_helper::backup_is_samesite()}
        if (isset($backupinfo['original_site_identifier_hash'])) {
            $this->xmlwriter->full_tag('original_site_identifier_hash', $backupinfo['original_site_identifier_hash']);
        } else {
            $this->xmlwriter->full_tag('original_site_identifier_hash', null);
        }
        $this->xmlwriter->full_tag('original_course_id', $originalcourseinfo['original_course_id']);
        $this->xmlwriter->full_tag('original_course_fullname', $originalcourseinfo['original_course_fullname']);
        $this->xmlwriter->full_tag('original_course_shortname', $originalcourseinfo['original_course_shortname']);
        $this->xmlwriter->full_tag('original_course_startdate', $originalcourseinfo['original_course_startdate']);
        $this->xmlwriter->full_tag('original_system_contextid', $this->converter->get_contextid(CONTEXT_SYSTEM));
        // note that even though we have original_course_contextid available, we regenerate the
        // original course contextid using our helper method to be sure that the data are consistent
        // within the MBZ file
        $this->xmlwriter->full_tag('original_course_contextid', $this->converter->get_contextid(CONTEXT_COURSE));

        // moodle_backup/information/details
        $this->xmlwriter->begin_tag('details');
        $this->write_xml('detail', array(
            'backup_id'     => $this->converter->get_id(),
            'type'          => backup::TYPE_1COURSE,
            'format'        => backup::FORMAT_MOODLE,
            'interactive'   => backup::INTERACTIVE_YES,
            'mode'          => backup::MODE_CONVERTED,
            'execution'     => backup::EXECUTION_INMEDIATE,
            'executiontime' => 0,
        ), array('/detail/backup_id'));
        $this->xmlwriter->end_tag('details');

        // moodle_backup/information/contents
        $this->xmlwriter->begin_tag('contents');

        // moodle_backup/information/contents/activities
        $this->xmlwriter->begin_tag('activities');
        $activitysettings = array();
        foreach ($this->converter->get_stash('coursecontents') as $activity) {
            $modinfo = $this->converter->get_stash('modinfo_'.$activity['modulename']);
            $modinstance = $modinfo['instances'][$activity['instanceid']];
            $this->write_xml('activity', array(
                'moduleid'      => $activity['cmid'],
                'sectionid'     => $activity['sectionid'],
                'modulename'    => $activity['modulename'],
                'title'         => $modinstance['name'],
                'directory'     => 'activities/'.$activity['modulename'].'_'.$activity['cmid']
            ));
            $activitysettings[] = array(
                'level'     => 'activity',
                'activity'  => $activity['modulename'].'_'.$activity['cmid'],
                'name'      => $activity['modulename'].'_'.$activity['cmid'].'_included',
                'value'     => (($modinfo['included'] === 'true' and $modinstance['included'] === 'true') ? 1 : 0));
            $activitysettings[] = array(
                'level'     => 'activity',
                'activity'  => $activity['modulename'].'_'.$activity['cmid'],
                'name'      => $activity['modulename'].'_'.$activity['cmid'].'_userinfo',
                //'value'     => (($modinfo['userinfo'] === 'true' and $modinstance['userinfo'] === 'true') ? 1 : 0));
                'value'     => 0); // todo hardcoded non-userinfo for now
        }
        $this->xmlwriter->end_tag('activities');

        // moodle_backup/information/contents/sections
        $this->xmlwriter->begin_tag('sections');
        $sectionsettings = array();
        foreach ($this->converter->get_stash_itemids('sectioninfo') as $sectionid) {
            $sectioninfo = $this->converter->get_stash('sectioninfo', $sectionid);
            $sectionsettings[] = array(
                'level'     => 'section',
                'section'   => 'section_'.$sectionid,
                'name'      => 'section_'.$sectionid.'_included',
                'value'     => 1);
            $sectionsettings[] = array(
                'level'     => 'section',
                'section'   => 'section_'.$sectionid,
                'name'      => 'section_'.$sectionid.'_userinfo',
                'value'     => 0); // @todo how to detect this from moodle.xml?
            $this->write_xml('section', array(
                'sectionid' => $sectionid,
                'title'     => $sectioninfo['number'], // because the title is not available
                'directory' => 'sections/section_'.$sectionid));
        }
        $this->xmlwriter->end_tag('sections');

        // moodle_backup/information/contents/course
        $this->write_xml('course', array(
            'courseid'  => $originalcourseinfo['original_course_id'],
            'title'     => $originalcourseinfo['original_course_shortname'],
            'directory' => 'course'));
        unset($originalcourseinfo);

        $this->xmlwriter->end_tag('contents');

        // moodle_backup/information/settings
        $this->xmlwriter->begin_tag('settings');

        // fake backup root seetings
        $rootsettings = array(
            'filename'         => $backupinfo['name'],
            'users'            => 0, // @todo how to detect this from moodle.xml?
            'anonymize'        => 0,
            'role_assignments' => 0,
            'activities'       => 1,
            'blocks'           => 1,
            'filters'          => 0,
            'comments'         => 0,
            'userscompletion'  => 0,
            'logs'             => 0,
            'grade_histories'  => 0,
        );
        unset($backupinfo);
        foreach ($rootsettings as $name => $value) {
            $this->write_xml('setting', array(
                'level' => 'root',
                'name'  => $name,
                'value' => $value));
        }
        unset($rootsettings);

        // activity settings populated above
        foreach ($activitysettings as $activitysetting) {
            $this->write_xml('setting', $activitysetting);
        }
        unset($activitysettings);

        // section settings populated above
        foreach ($sectionsettings as $sectionsetting) {
            $this->write_xml('setting', $sectionsetting);
        }
        unset($sectionsettings);

        $this->xmlwriter->end_tag('settings');

        $this->xmlwriter->end_tag('information');
        $this->xmlwriter->end_tag('moodle_backup');

        $this->close_xml_writer();

        ////////////////////////////////////////////////////////////////////////
        // write files.xml
        ////////////////////////////////////////////////////////////////////////
        $this->open_xml_writer('files.xml');
        $this->xmlwriter->begin_tag('files');
        foreach ($this->converter->get_stash_itemids('files') as $fileid) {
            $this->write_xml('file', $this->converter->get_stash('files', $fileid), array('/file/id'));
        }
        $this->xmlwriter->end_tag('files');
        $this->close_xml_writer('files.xml');

        ////////////////////////////////////////////////////////////////////////
        // write scales.xml
        ////////////////////////////////////////////////////////////////////////
        $this->open_xml_writer('scales.xml');
        $this->xmlwriter->begin_tag('scales_definition');
        foreach ($this->converter->get_stash_itemids('scales') as $scaleid) {
            $this->write_xml('scale', $this->converter->get_stash('scales', $scaleid), array('/scale/id'));
        }
        $this->xmlwriter->end_tag('scales_definition');
        $this->close_xml_writer('scales.xml');

        ////////////////////////////////////////////////////////////////////////
        // write course/inforef.xml
        ////////////////////////////////////////////////////////////////////////
        $this->open_xml_writer('course/inforef.xml');
        $this->xmlwriter->begin_tag('inforef');

        $this->xmlwriter->begin_tag('fileref');
        // legacy course files
        $fileids = $this->converter->get_stash('course_files_ids');
        if (is_array($fileids)) {
            foreach ($fileids as $fileid) {
                $this->write_xml('file', array('id' => $fileid));
            }
        }
        // todo site files
        // course summary files
        $fileids = $this->converter->get_stash('course_summary_files_ids');
        if (is_array($fileids)) {
            foreach ($fileids as $fileid) {
                $this->write_xml('file', array('id' => $fileid));
            }
        }
        $this->xmlwriter->end_tag('fileref');

        $this->xmlwriter->begin_tag('question_categoryref');
        foreach ($this->converter->get_stash_itemids('question_categories') as $questioncategoryid) {
            $this->write_xml('question_category', array('id' => $questioncategoryid));
        }
        $this->xmlwriter->end_tag('question_categoryref');

        $this->xmlwriter->end_tag('inforef');
        $this->close_xml_writer();

        // make sure that the files required by the restore process have been generated.
        // missing file may happen if the watched tag is not present in moodle.xml (for example
        // QUESTION_CATEGORIES is optional in moodle.xml but questions.xml must exist in
        // moodle2 format) or the handler has not been implemented yet.
        // apparently this must be called after the handler had a chance to create the file.
        $this->make_sure_xml_exists('questions.xml', 'question_categories');
        $this->make_sure_xml_exists('groups.xml', 'groups');
        $this->make_sure_xml_exists('outcomes.xml', 'outcomes_definition');
        $this->make_sure_xml_exists('users.xml', 'users');
        $this->make_sure_xml_exists('course/roles.xml', 'roles',
            array('role_assignments' => array(), 'role_overrides' => array()));
        $this->make_sure_xml_exists('course/enrolments.xml', 'enrolments',
            array('enrols' => array()));
    }
943445
public function reset()
    {
        $this->layout = null;
        $this->namedCompilers = [];
        $this->importPaths = [];
        $this->importNodeYielded = false;
        $this->importNode = null;
        $this->parentCompiler = null;
    }
788311
public function after_restore_enrol() {
        global $DB;

        // Need to go through and change the values.
        foreach ($this->tools as $tool) {
            $updatetool = new stdClass();
            $updatetool->id = $tool->id;
            $updatetool->enrolid = $this->get_mappingid('enrol', $tool->enrolid);
            $updatetool->contextid = $this->get_mappingid('context', $tool->contextid);
            $DB->update_record('enrol_lti_tools', $updatetool);
        }
    }
1003143
public void restoreState() {
    h0=s0;
    h1=s1;
    h2=s2;
    h3=s3;
    h4=s4;
    
    length = saveLength;
    
    finalBuffer.clear();
    finalBuffer.put(saveBuffer);
  }
1206077
public function restore()
     {
         if ($this->isKept) {
             $key = $this->getPKvalue();
             $sql = 'update '.$this->DBtable.' set deleted_at=null where '.$this->keyName." = '".$key."' ";
             //
             if (Database::exec($sql)) {
                 // Code to execute the init the model
             }
         }
     }
1060768
protected function init_resolve()
	{
		if (is_null($this->froot))
		{
			$this->froot = Eresus_Kernel::app()->getFsRoot() . '/';
		}

		$this->fdata = $this->froot . 'data' . DIRECTORY_SEPARATOR;
		$this->fstyle = $this->froot . 'style' . DIRECTORY_SEPARATOR;

		if (is_null($this->path))
		{
			$s = substr(dirname($_SERVER['SCRIPT_FILENAME']), strlen($_SERVER['DOCUMENT_ROOT']));
			if (strlen($s) == 0 || substr($s, -1) != '/')
			{
				$s .= '/';
			}
			if (substr($s, 0, 1) != '/')
			{
				$s = '/' . $s;
			}
			$this->path = $s;
		}
	}
992949
public function clear()
    {
        $keys = self::$instance->keys($this->options['prefix'].'*');
        if ($keys) {
            self::$instance->del(...$keys);
        }

        return true;
    }
541501
public function reset()
	{
		$this->started = $this->now();
		$this->prefix  = '';
		$this->marks   = array();
		$this->memory  = memory_get_usage(true);
	}
629185
public function reset()
    {
        $this->choiceCounter = 0;
        $this->setExploration(new SplStack());
        $this->setExplorationMarker(array());
        $this->setLastRendering(null);
        $this->setRenderingStack(new SplStack());
        $this->setXmlBaseStack(new SplStack());
        $this->setDocument(new DOMDocument('1.0', 'UTF-8'));
        $this->setStylesheets($this->getDocument()->createDocumentFragment());
        $this->setCurrentInteraction(null);
    }
1284198
private function restore()
    {
        $this->deleteDirectory('app');
        $this->deleteDirectory('bootstrap');
        $this->deleteDirectory('routes');

        $this->info('Copying back App');
        File::copyDirectory($this->backupDirectory . '/app', 'app');
        $this->info('Copying back bootstrap');
        File::copyDirectory($this->backupDirectory . '/bootstrap', 'bootstrap');
        $this->info('Copying back routes');
        File::copyDirectory($this->backupDirectory . '/routes', 'routes');

        File::copy($this->backupDirectory . '/composer.json', 'composer.json');
        File::copy($this->backupDirectory . '/config/auth.php', 'config/auth.php');
        File::copy($this->backupDirectory . '/config/database.php', 'config/database.php');

        $this->info('Backup successful');
    }
130296
public function Reset() {
      // Check the _NoReset flag.
      switch($this->_NoReset) {
         case 1:
            $this->_NoReset = 0;
            return;
         case 2:
            return;
      }
      $this->_Selects         = array();
      $this->_Froms           = array();
      $this->_Joins           = array();
      $this->_Wheres          = array();
      $this->_WhereConcat     = 'and';
      $this->_WhereConcatDefault = 'and';
      $this->_WhereGroupCount = 0;
      $this->_OpenWhereGroupCount = 0;
      $this->_GroupBys        = array();
      $this->_Havings         = array();
      $this->_OrderBys        = array();
      $this->_AliasMap        = array();
      
      $this->_CacheKey        = NULL;
      $this->_CacheOperation  = NULL;
      $this->_CacheOptions    = NULL;
      $this->_Distinct        = FALSE;
      $this->_Limit           = FALSE;
      $this->_Offset          = FALSE;
      $this->_Order           = FALSE;
      
      $this->_Sets            = array();
      $this->_NamedParameters = array();
      $this->_Options         = array();
      
      return $this;
   }