Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 95e0341

Browse files
author
Julien Jomier
committed
BUG: Fixing issue with upload when the file already exists
ENH: Added statistics when migration from MIDAS2
1 parent d89af46 commit 95e0341

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

core/controllers/UserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function indexAction()
4545
$users = $this->User->getPublicUsers();
4646
}
4747

48-
$this->Component->Sortdao->field = 'name';
48+
$this->Component->Sortdao->field = 'firstname';
4949
$this->Component->Sortdao->order = 'asc';
5050
usort($users, array($this->Component->Sortdao, 'sortByName'));
5151
$users = $this->Component->Sortdao->arrayUniqueDao($users);

core/controllers/components/MIDAS2MigrationComponent.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ private function _createFolderForItem($collectionId, $parentFolderid)
4848
{
4949
set_time_limit(0);
5050
$modelLoader = new MIDAS_ModelLoader;
51-
$Folder = $modelLoader->loadModel("Folder");
51+
$Folder = $modelLoader->loadModel("Folder");
52+
$Bitstream = $modelLoader->loadModel("Bitstream");
5253
$Item = $modelLoader->loadModel("Item");
5354
$ItemRevision = $modelLoader->loadModel("ItemRevision");
5455
$Group = $modelLoader->loadModel("Group");
@@ -268,10 +269,10 @@ private function _createFolderForItem($collectionId, $parentFolderid)
268269

269270
$UploadComponent = new UploadComponent();
270271
$UploadComponent->uploadBitstream($bitstreamDao, $assetstoreDao);
271-
unset($UploadComponent);
272272

273273
// Upload the bitstream ifnecessary (based on the assetstore type)
274274
$ItemRevision->addBitstream($itemRevisionDao, $bitstreamDao);
275+
unset($UploadComponent);
275276
}
276277
}
277278
}

core/controllers/components/UploadComponent.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ private function _uploadLocalBitstream($bitstreamdao, $assetstoredao)
5656
// This should be rare (MD5 has a low probably for collisions)
5757
if(file_exists($fullpath))
5858
{
59-
//throw new Zend_Exception("File already in the assetstore.");
59+
// Set the new path
60+
$bitstreamdao->setPath($path);
6061
return false;
6162
}
6263

@@ -72,7 +73,6 @@ private function _uploadLocalBitstream($bitstreamdao, $assetstoredao)
7273

7374
// Set the new path
7475
$bitstreamdao->setPath($path);
75-
7676
} // end _uploadLocalBitstream()
7777

7878
/** Upload a bitstream */
@@ -393,7 +393,7 @@ public function createNewRevision($userDao, $name, $path, $item_revision, $chang
393393
$bitstreamDao->setAssetstoreId($defaultAssetStoreId);
394394
$assetstoreDao = $assetstoreModel->load($defaultAssetStoreId);
395395

396-
// Upload the bitstream ifnecessary (based on the assetstore type)
396+
// Upload the bitstream if necessary (based on the assetstore type)
397397
$this->uploadBitstream($bitstreamDao, $assetstoreDao);
398398
$checksum = $bitstreamDao->getChecksum();
399399
$tmpBitstreamDao = $bitstreamModel->getByChecksum($checksum);

core/models/pdo/ItemRevisionModel.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,17 @@ function addBitstream($itemRevisionDao, $bitstreamDao)
122122
$modelLoad = new MIDAS_ModelLoader();
123123
$BitstreamModel = $modelLoad->loadModel('Bitstream');
124124
$ItemModel = $modelLoad->loadModel('Item');
125-
// $TaskModel = $modelLoad->loadModel('Task');
125+
// $TaskModel = $modelLoad->loadModel('Task');
126126

127127
$bitstreamDao->setItemrevisionId($itemRevisionDao->getItemrevisionId());
128128

129129
// Save the bistream
130-
if(!isset($bitstreamDao->saved) || !$bitstreamDao->saved)
131-
{
132-
$bitstreamDao->setDate(date('c'));
133-
$BitstreamModel->save($bitstreamDao);
134-
}
130+
$bitstreamDao->setDate(date('c'));
131+
$BitstreamModel->save($bitstreamDao);
135132

136133
$item = $itemRevisionDao->getItem($bitstreamDao);
137134
$item->setSizebytes($this->getSize($itemRevisionDao));
138135
$item->setDate(date('c'));
139-
140136

141137
$modulesThumbnail = Zend_Registry::get('notifier')->notify(MIDAS_NOTIFY_CREATE_THUMBNAIL);
142138
if(empty($modulesThumbnail))

core/views/user/index.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $this->headScript()->appendFile($this->coreWebroot.'/public/js/user/user.index.j
2424
?>
2525
<div class="userBlock">
2626
<a class="userTitle" href="<?php echo $this->webroot.'/user/'.$user->getKey();?>">
27-
<?php echo $user->getFirstname()?></a>
27+
<?php echo $user->getFirstname().' '.$user->getLastname()?></a>
2828
<br/>
2929
</div>
3030
<?php

0 commit comments

Comments
 (0)