Skip to content

Commit

Permalink
# [joomla#27196] Unable to add a trashed Content Language again. Thanks
Browse files Browse the repository at this point in the history
Michael
  • Loading branch information
mbabker authored and infograf768 committed Dec 3, 2011
1 parent a6b9e1b commit 83bcf23
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `#__languages` ADD UNIQUE `idx_image` (`image`);
ALTER TABLE `#__languages` ADD UNIQUE `idx_langcode` (`lang_code`);
2 changes: 1 addition & 1 deletion administrator/components/com_languages/models/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function save($data)

// Store the data
if (!$table->store()) {
$this->setError($this->_db->getErrorMsg());
$this->setError($table->getError());
return false;
}

Expand Down
3 changes: 3 additions & 0 deletions administrator/language/en-GB/en-GB.lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ JLIB_DATABASE_ERROR_INVALID_LOCATION="%s: :setLocation - Invalid location"
JLIB_DATABASE_ERROR_INVALID_NODE_RECURSION="%s: :move Failed - Cannot move the node to be a child of itself"
JLIB_DATABASE_ERROR_INVALID_PARENT_ID="Invalid parent id."
JLIB_DATABASE_ERROR_LANGUAGE_NO_TITLE="The language should have a title"
JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_IMAGE="A content language already exists with this Image Prefix"
JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_LANG_CODE="A content language already exists with this Language Tag"
JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_SEF="A content language already exists with this URL Language Code"
JLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER="Unable to load Database Driver: %s"
JLIB_DATABASE_ERROR_MENUTYPE_EMPTY="Menu type empty"
JLIB_DATABASE_ERROR_MENUTYPE_EXISTS="Menu type exists: %s"
Expand Down
3 changes: 3 additions & 0 deletions installation/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ $ -> Language fix or change
- -> Removed
! -> Note

03-Dec-2011 Jean-Marie Simonet
# [#27196] Unable to add a trashed Content Language again. Thanks Michael

03-Dec-2011 Christophe Demko
^ [#26778] Update TinyMCE to 3.4.7
# [#27255] Fix some E_STRICT warnings
Expand Down
4 changes: 3 additions & 1 deletion installation/sql/mysql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ CREATE TABLE `#__categories` (
`checked_out` int(11) unsigned NOT NULL default '0',
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
`access` integer unsigned NOT NULL default '0',
`params` TEXT NOT NULL,
`params` TEXT NOT NULL,
`metadesc` varchar(1024) NOT NULL COMMENT 'The meta description for the page.',
`metakey` varchar(1024) NOT NULL COMMENT 'The meta keywords for the page.',
`metadata` varchar(2048) NOT NULL COMMENT 'JSON encoded metadata properties.',
Expand Down Expand Up @@ -545,6 +545,8 @@ CREATE TABLE `#__languages` (
`ordering` int(11) NOT NULL default '0',
PRIMARY KEY (`lang_id`),
UNIQUE `idx_sef` (`sef`),
UNIQUE `idx_image` (`image`),
UNIQUE `idx_langcode` (`lang_code`),
INDEX `idx_ordering` (`ordering`)
) DEFAULT CHARSET=utf8;

Expand Down
3 changes: 3 additions & 0 deletions language/en-GB/en-GB.lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ JLIB_DATABASE_ERROR_INVALID_LOCATION="%s: :setLocation - Invalid location"
JLIB_DATABASE_ERROR_INVALID_NODE_RECURSION="%s: :move Failed - Cannot move the node to be a child of itself"
JLIB_DATABASE_ERROR_INVALID_PARENT_ID="Invalid parent id."
JLIB_DATABASE_ERROR_LANGUAGE_NO_TITLE="The language should have a title"
JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_IMAGE="A content language already exists with this Image Prefix"
JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_LANG_CODE="A content language already exists with this Language Tag"
JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_SEF="A content language already exists with this URL Language Code"
JLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER="Unable to load Database Driver: %s"
JLIB_DATABASE_ERROR_MENUTYPE_EMPTY="Menu type empty"
JLIB_DATABASE_ERROR_MENUTYPE_EXISTS="Menu type exists: %s"
Expand Down
35 changes: 35 additions & 0 deletions libraries/joomla/database/table/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,39 @@ public function check()

return true;
}

/**
* Overrides JTable::store to check unique fields.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success.
*
* @since 11.4
*/
public function store($updateNulls = false)
{
// Verify that the sef field is unique
$table = JTable::getInstance('Language', 'JTable');
if ($table->load(array('sef' => $this->sef)) && ($table->lang_id != $this->lang_id || $this->lang_id == 0))
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_SEF'));
return false;
}

// Verify that the image field is unique
if ($table->load(array('image' => $this->image)) && ($table->lang_id != $this->lang_id || $this->lang_id == 0))
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_IMAGE'));
return false;
}

// Verify that the language code is unique
if ($table->load(array('lang_code' => $this->lang_code)) && ($table->lang_id != $this->lang_id || $this->lang_id == 0))
{
$this->setError(JText::_('JLIB_DATABASE_ERROR_LANGUAGE_UNIQUE_LANG_CODE'));
return false;
}
return parent::store($updateNulls);
}
}
Empty file modified media/system/images/mooRainbow/blank.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/system/images/mooRainbow/moor_arrows.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/system/images/mooRainbow/moor_boverlay.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/system/images/mooRainbow/moor_cursor.gif
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/system/images/mooRainbow/moor_slider.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified media/system/images/mooRainbow/moor_woverlay.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 83bcf23

Please sign in to comment.