<commit_before><?php
set_time_limit(0);
$RUNTIME_NOAPPS = true;
require_once '../../lib/base.php';

if (OC::checkUpgrade(false)) {
	\OC_DB::enableCaching(false);
	$updateEventSource = new OC_EventSource();
	$watcher = new UpdateWatcher($updateEventSource);
	OC_Hook::connect('update', 'success', $watcher, 'success');
	OC_Hook::connect('update', 'error', $watcher, 'error');
	OC_Hook::connect('update', 'error', $watcher, 'failure');
	$watcher->success('Turned on maintenance mode');
	try {
		$result = OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml');
		$watcher->success('Updated database');

		// do a file cache upgrade for users with files
		// this can take loooooooooooooooooooooooong
		__doFileCacheUpgrade($watcher);
	} catch (Exception $exception) {
		$watcher->failure($exception->getMessage());
	}
	OC_Config::setValue('version', implode('.', OC_Util::getVersion()));
	OC_App::checkAppsRequirements();
	// load all apps to also upgrade enabled apps
	OC_App::loadApps();
	OC_Config::setValue('maintenance', false);
	$watcher->success('Turned off maintenance mode');
	$watcher->done();
}

/**
 * The FileCache Upgrade routine
 *
 * @param UpdateWatcher $watcher
 */
function __doFileCacheUpgrade($watcher) {
	$query = \OC_DB::prepare('
		SELECT DISTINCT user
		FROM`*PREFIX*fscache`
	');
	$result = $query->execute();
	$users = $result->fetchAll();
	if(count($users) == 0) {
		return;
	}<commit_msg>Add missing backticks.<commit_after><?php
set_time_limit(0);
$RUNTIME_NOAPPS = true;
require_once '../../lib/base.php';

if (OC::checkUpgrade(false)) {
	\OC_DB::enableCaching(false);
	$updateEventSource = new OC_EventSource();
	$watcher = new UpdateWatcher($updateEventSource);
	OC_Hook::connect('update', 'success', $watcher, 'success');
	OC_Hook::connect('update', 'error', $watcher, 'error');
	OC_Hook::connect('update', 'error', $watcher, 'failure');
	$watcher->success('Turned on maintenance mode');
	try {
		$result = OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml');
		$watcher->success('Updated database');

		// do a file cache upgrade for users with files
		// this can take loooooooooooooooooooooooong
		__doFileCacheUpgrade($watcher);
	} catch (Exception $exception) {
		$watcher->failure($exception->getMessage());
	}
	OC_Config::setValue('version', implode('.', OC_Util::getVersion()));
	OC_App::checkAppsRequirements();
	// load all apps to also upgrade enabled apps
	OC_App::loadApps();
	OC_Config::setValue('maintenance', false);
	$watcher->success('Turned off maintenance mode');
	$watcher->done();
}

/**
 * The FileCache Upgrade routine
 *
 * @param UpdateWatcher $watcher
 */
function __doFileCacheUpgrade($watcher) {
	$query = \OC_DB::prepare('
		SELECT DISTINCT `user`
		FROM `*PREFIX*fscache`
	');
	$result = $query->execute();
	$users = $result->fetchAll();
	if(count($users) == 0) {
		return;
	}
{'fraction_non_alphanumeric': 0.17912011173184358, 'fraction_numerical': 0.0013966480446927375, 'mean_word_length': 6.109181141439206, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 2, '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': '3352276', 'n_tokens_mistral': 985, 'n_tokens_neox': 969, 'n_words': 195}