Commit 64ae2ba9 authored by Harry Glatz's avatar Harry Glatz

Merge branch '290-save-composer-json-into-version-model' into 'develop'

Resolve "Save composer.json into version model"

Closes #290

See merge request !340
parents bc03b075 98b37c05
Pipeline #4420 passed with stages
in 4 minutes and 45 seconds
......@@ -272,6 +272,11 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $zipFileSize = 0;
/**
* @var string
*/
protected $composerInfo = '';
/**
* Constructor. Initializes all ObjectStorage instances.
*/
......@@ -1133,8 +1138,41 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
return $this->zipFileSize;
}
/**
* @return string
*/
public function getComposerInfo()
{
return $this->composerInfo;
}
/**
* @param string $composerInfo
* @return void
*/
public function setComposerInfo(string $composerInfo)
{
$this->composerInfo = $composerInfo;
}
/** Helper functions */
/**
* @return string
*/
public function getComposerName()
{
$composerName = '';
if ($this->composerInfo !== '') {
$composerInfoAsArray = json_decode($this->composerInfo, true);
if (!empty($composerInfoAsArray)) {
$composerName = $composerInfoAsArray['name'];
}
}
return $composerName;
}
/**
* @return \T3o\TerFe2\Domain\Model\Relation
*/
......
......@@ -101,6 +101,14 @@ class TerIndexer extends \ApacheSolrForTypo3\Solr\IndexQueue\Indexer
$document->setField('insecure_boolS', $extension->getLastVersion()->getReviewState() === -1);
$document->setField('outdated_boolS', $extension->getLastVersion()->getReviewState() === -2);
// composer support
$document->setField('supportsComposer_boolS', false);
$document->setField('composerName_stringS', '');
if ($extension->getLastVersion()->getComposerName()) {
$document->setField('supportsComposer_boolS', true);
$document->setField('composerName_stringS', $extension->getLastVersion()->getComposerName());
}
// does this extension supports different versions?
// @todo: use JSON with all versions to get them
$document->setField('supports7_boolS', false);
......
......@@ -320,7 +320,8 @@ class ImportExtensionsFromQueueTask extends Task
'has_zip_file' => 0,
'has_images' => 0,
't3x_file_size' => @filesize($t3xFile),
'zip_file_size' => 0
'zip_file_size' => 0,
'composer_info' => $extData['composerinfo']
];
$tableName = 'tx_terfe2_domain_model_version';
......
......@@ -21,10 +21,10 @@ return array(
'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('ter_fe2') . 'Resources/Public/Icons/version.gif',
),
'interface' => array(
'showRecordFieldList' => 'title,description,version_number,version_string,upload_date,upload_comment,download_counter,frontend_download_counter,state,em_category,load_order,priority,shy,internal,do_not_load_in_fe,uploadfolder,clear_cache_on_load,module,create_dirs,modify_tables,lock_type,cgl_compliance,cgl_compliance_note,review_state,manual,has_manual,software_relations,author,file_hash,extension_provider,has_zip_file,has_images',
'showRecordFieldList' => 'title,description,version_number,version_string,upload_date,upload_comment,download_counter,frontend_download_counter,state,em_category,load_order,priority,shy,internal,do_not_load_in_fe,uploadfolder,clear_cache_on_load,module,create_dirs,modify_tables,lock_type,cgl_compliance,cgl_compliance_note,review_state,manual,has_manual,software_relations,author,file_hash,extension_provider,has_zip_file,has_images,composer_info',
),
'types' => array(
'1' => array('showitem' => 'title,description,version_number,version_string,upload_date,upload_comment,download_counter,frontend_download_counter,state,em_category,load_order,priority,shy,internal,do_not_load_in_fe,uploadfolder,clear_cache_on_load,module,create_dirs,modify_tables,lock_type,cgl_compliance,cgl_compliance_note,review_state,manual,has_manual,software_relations,author,file_hash,extension_provider,has_zip_file,has_images'),
'1' => array('showitem' => 'title,description,version_number,version_string,upload_date,upload_comment,download_counter,frontend_download_counter,state,em_category,load_order,priority,shy,internal,do_not_load_in_fe,uploadfolder,clear_cache_on_load,module,create_dirs,modify_tables,lock_type,cgl_compliance,cgl_compliance_note,review_state,manual,has_manual,software_relations,author,file_hash,extension_provider,has_zip_file,has_images,composer_info'),
),
'palettes' => array(
'1' => array('showitem' => ''),
......@@ -404,5 +404,14 @@ return array(
'type' => 'passthrough',
),
),
'composer_info' => array(
'exclude' => 0,
'label' => 'Composer Info (JSON)',
'config' => array(
'type' => 'input',
'size' => 30,
'eval' => 'trim'
),
),
),
);
......@@ -118,6 +118,7 @@ CREATE TABLE tx_terfe2_domain_model_version (
has_images tinyint(4) unsigned DEFAULT '0' NOT NULL,
t3x_file_size bigint(15) unsigned DEFAULT '0' NOT NULL,
zip_file_size bigint(15) unsigned DEFAULT '0' NOT NULL,
composer_info text NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment