コード例 #1
0
ファイル: Record.php プロジェクト: grharry/vufind
 /**
  * Update an existing entry in the record table or create a new one
  *
  * @param string $id      Record ID
  * @param string $source  Data source
  * @param string $rawData Raw data from source
  *
  * @return Updated or newly added record
  */
 public function updateRecord($id, $source, $rawData)
 {
     $records = $this->select(['record_id' => $id, 'source' => $source]);
     if ($records->count() == 0) {
         $record = $this->createRow();
     } else {
         $record = $records->current();
     }
     $record->record_id = $id;
     $record->source = $source;
     $record->data = serialize($rawData);
     $record->version = \VuFind\Config\Version::getBuildVersion();
     $record->updated = date('Y-m-d H:i:s');
     // Create or update record.
     $record->save();
     return $record;
 }
コード例 #2
0
 /**
  * Prompt the user for a source version (to upgrade from 2.x).
  *
  * @return mixed
  */
 public function getsourceversionAction()
 {
     // Process form submission:
     $version = $this->params()->fromPost('sourceversion');
     if (!empty($version)) {
         $this->cookie->newVersion = \VuFind\Config\Version::getBuildVersion();
         if (floor($version) != 2) {
             $this->flashMessenger()->addMessage('Illegal version number.', 'error');
         } else {
             if ($version >= $this->cookie->newVersion) {
                 $this->flashMessenger()->addMessage("Source version must be less than {$this->cookie->newVersion}.", 'error');
             } else {
                 $this->cookie->oldVersion = $version;
                 $this->cookie->sourceDir = realpath(APPLICATION_PATH);
                 // Clear out request to avoid infinite loop:
                 $this->getRequest()->getPost()->set('sourceversion', '');
                 $this->processSkipParam();
                 return $this->forwardTo('Upgrade', 'Home');
             }
         }
     }
     // If we got this far, we need to send the user back to the form:
     return $this->forwardTo('Upgrade', 'GetSourceDir');
 }
コード例 #3
0
ファイル: VersionTest.php プロジェクト: grharry/vufind
 /**
  * Test with a fixture to confirm that the right value is extracted.
  *
  * @return void
  */
 public function testKnownVersion()
 {
     $fixture = __DIR__ . '/../../../../fixtures/configs/buildxml-2.5';
     $this->assertEquals('2.5', Version::getBuildVersion($fixture));
 }