View file Core/optimize.php

File size: 1.11Kb
<?php
require_once ('connect.php');
require_once ('core.php');
require_once ('function.php');
$cats = $mysqli->query("SELECT `id` FROM `category`");
while($row = $cats->fetch_assoc())
	{
		$saits = $mysqli->query("SELECT `id` FROM `sait` WHERE `category` = '".$row['id']."'")->num_rows;
		$mysqli->query("UPDATE `category` SET `count` = '".$saits."' WHERE `id` = '".$row['id']."'");		
	}
$users = $mysqli->query("SELECT `id` FROM `users`");
while($row = $users->fetch_assoc())
	{
		$saits = $mysqli->query("SELECT `id` FROM `sait` WHERE `uid` = '".$row['id']."'")->num_rows;
		$mysqli->query("UPDATE `users` SET `platforms` = '".$saits."' WHERE `id` = '".$row['id']."'");		
	}
$mysqli->query("OPTIMIZE TABLE `browsers`");
$mysqli->query("OPTIMIZE TABLE `category`");
$mysqli->query("OPTIMIZE TABLE `country`");
$mysqli->query("OPTIMIZE TABLE `days`");
$mysqli->query("OPTIMIZE TABLE `hours`");
$mysqli->query("OPTIMIZE TABLE `month`");
$mysqli->query("OPTIMIZE TABLE `operators`");
$mysqli->query("OPTIMIZE TABLE `sait`");
$mysqli->query("OPTIMIZE TABLE `shows`");
$mysqli->query("OPTIMIZE TABLE `users`");
?>