public function requestCheckin(&$error, $newVersion, $commitMessage)
 {
     $config = $this->getConfiguration();
     $versioning = new DIM_Versioning();
     $requestData = array("action" => "checkin", "email" => $config["client"]["user-email"], "auth-key" => $config["client"]["auth-key"], "version" => $newVersion, "old-version" => $versioning->getLatestVersion(), "commit-message" => $commitMessage);
     $rawResponse = Network_IO::makeServerRequest($config["client"]["server-host"], $requestData);
     $responseParts = explode(":", $rawResponse);
     if ($responseParts[0] == "1") {
         // successful checkin!
         $this->state->checkIn();
         $this->logger->addLogItem("Database Checked In", "state");
         $queryManager = new DIM_QueryManager();
         $versionFileName = $queryManager->makeVersionFile($responseParts[1], $responseParts[2]);
         $this->logger->addLogItem("Version file {$versionFileName} created", "version");
         $newVersion = $versioning->addNewVersion($responseParts[1], $responseParts[2]);
         $this->logger->addLogItem("Database now at version {$newVersion}", "version");
         return true;
     } else {
         $error = $responseParts[1];
         return false;
     }
 }
 public function resumeUpdate()
 {
     // creates $updateCache
     include $this->getUpdateCacheFilename();
     // sort it backwards so we can POP (which is a nicer sound than SHIFT)
     krsort($updateCache);
     $versioning = new DIM_Versioning();
     $database = new Database_IO($this->getDatabaseSettings());
     while ($update = array_pop($updateCache)) {
         $database->query(base64_decode($update["queries"]), MULTI_QUERY, true);
         $versioning->addNewVersion($update["version"], $update["commitMessage"]);
         $this->logger->addLogItem("Local database now updated to version " . $update["version"], "update");
         // save the update cache now in case we die on the next iteration
         $this->saveUpdateCache($updateCache);
     }
     // if we get to here then all is well!
     unlink($this->getUpdateCacheFilename());
 }