Beispiel #1
0
 /**
  * Starts site synchronization process.
  * @return string
  */
 public function SynchronizeSite()
 {
     if (!$this->checkwebext()) {
         return "Function unavailable in this version.";
     }
     try {
         if (WebServiceWeb::WS()) {
             WebServiceWeb::WS()->LoginEx();
             $ret1 = WebServiceWeb::WS()->GetService();
             $ret2 = $ret3 = $ret4 = $ret5 = $ret6 = $ret7 = $ret8 = $ret9 = $ret10 = $ret11 = $ret12 = $ile = 0;
             if ($ret1 != 0) {
                 Miejsca::DeleteMiejsce(0, 0);
                 $ret2 = WebServiceWeb::WS()->GetMiejsca();
                 Menus::DeleteMenu(0);
                 $ret3 = WebServiceWeb::WS()->GetMenu();
                 Artykuly::DeleteArtykul(0);
                 $ret4 = WebServiceWeb::WS()->GetArtykuly();
                 ArkuszeSkrypty::DeleteArkuszSkrypt(0, 0);
                 $ret5 = WebServiceWeb::WS()->GetArkuszeSkrypty();
                 Banery::DeleteBaner(0);
                 $ret6 = WebServiceWeb::WS()->GetBanery();
                 Opcje::DeleteOpcja(null);
                 $ret7 = WebServiceWeb::WS()->GetOpcje();
                 JezykiTeksty::DeleteJezyk(null);
                 $ret8 = WebServiceWeb::WS()->GetJezyki();
                 $ret9 = WebServiceWeb::WS()->GetGalerie();
                 Agents::DeleteAgent(0);
                 $ret10 = WebServiceWeb::WS()->GetAgenci();
                 Departments::DeleteDepartment(0);
                 $ret11 = WebServiceWeb::WS()->GetOddzialy();
                 Osoby::DeleteOsoba(null);
                 $ret12 = WebServiceWeb::WS()->GetOsoby();
                 $ile = WebServiceWeb::WS()->HasNewsLetter();
                 $this->SaveParam(WebAPI::PARAM_HAS_NEWSLETTER, $ile > 0 ? 1 : 0);
                 GaleriePozycje::IndeksujGaleriePozycjeDlaArtykulow();
                 if (Config::$UseOptionsDiskCache) {
                     $this->ClearOptionsCache();
                 }
                 if (Config::$UseLanguageDiskCache) {
                     $this->ClearLanguageCache();
                 }
             }
             WebServiceWeb::WS()->Logout();
             return "Serwisy: {$ret1}, Miejsca: {$ret2}, Menu: {$ret3}, Artykuly: {$ret4}, Arkusze/JS: {$ret5}, Banery: {$ret6}, Opcje: {$ret7}, Jezyki: {$ret8}, Galerie: {$ret9}, NewsL: {$ile}, Agenci: {$ret10}, Oddzialy: {$ret11}, Osoby: {$ret12}";
         } else {
             return 'Error: WebServiceWeb not available';
         }
     } catch (Exception $ex) {
         Errors::LogError("WebAPI:SynchronizeSite", $ex->getMessage());
         return "ERROR";
     }
 }