<commit_before><?php

/**
 * Background save function for the `Save & Keep Editing` option
 * in the page edit form.
 */

$page->layout = false;
header ('Content-Type: application/json');

if (! User::require_admin ()) {
	$res = new StdClass;
	$res->success = false;
	$res->error = i18n_get ('Authorization required.');
	echo json_encode ($res);
	return;
}

$error = false;

$o = new Webpage ($_GET['id']);
if ($o->error) {
	$error = $o->error;
} else {
	foreach ($_POST as $k => $v) {
		if ($k != $o->key && isset ($o->data[$k])) {
			$o->{$k} = $v;
		}
	}

	if (! $o->put ()) {
		$error = $o->error;
	} else {
		Versions::add ($o);<commit_msg>admin/bgsave now clears cached versions<commit_after><?php

/**
 * Background save function for the `Save & Keep Editing` option
 * in the page edit form.
 */

$page->layout = false;
header ('Content-Type: application/json');

if (! User::require_admin ()) {
	$res = new StdClass;
	$res->success = false;
	$res->error = i18n_get ('Authorization required.');
	echo json_encode ($res);
	return;
}

$error = false;

$o = new Webpage ($_GET['id']);
if ($o->error) {
	$error = $o->error;
} else {
	foreach ($_POST as $k => $v) {
		if ($k != $o->key && isset ($o->data[$k])) {
			$o->{$k} = $v;
		}
	}

	if (! $o->put ()) {
		$error = $o->error;
	} else {
		Versions::add ($o);
		$memcache->delete ('_admin_page_' . $_GET['id']);
{'fraction_non_alphanumeric': 0.22880116959064328, 'fraction_numerical': 0.0029239766081871343, 'mean_word_length': 3.5633333333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '2464565', 'n_tokens_mistral': 545, 'n_tokens_neox': 535, 'n_words': 136}