Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Controller/LanguagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function admin_compare_iso_list_to_core() {

public function admin_set_primary_languages_active() {
$languages = $this->Language->getPrimaryLanguages('list');
$this->Language->updateAll(['status' => Language::STATUS_ACTIVE], ['id' => array_keys($languages)]);
$this->Language->updateAllJoinless(['status' => Language::STATUS_ACTIVE], ['id' => array_keys($languages)]);

$this->Flash->success(__('%s of %s set active', $this->Language->getAffectedRows(), count($languages)));
return $this->redirect(['action' => 'index']);
Expand Down
5 changes: 2 additions & 3 deletions Controller/MimeTypesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ public function admin_allocate() {
$fileExt = $type['MimeType']['ext'];
$image = $this->MimeType->MimeTypeImage->find('first', ['conditions' => ['MimeTypeImage.name' => $fileExt]]);
if (!empty($image)) {
$this->MimeType->id = $type['MimeType']['id'];
//$data = array()
if ($this->MimeType->saveField('mime_type_image_id', $image['MimeTypeImage']['id'])) {
$id = $type['MimeType']['id'];
if ($this->MimeType->saveFieldById($id, 'mime_type_image_id', $image['MimeTypeImage']['id'])) {
$addedIcon[] = $fileExt . ' ' . CHAR_ARROWS . ' ' . $image['MimeTypeImage']['name'] . '.' . (!empty($image['MimeTypeImage']['ext']) ? $image['MimeTypeImage']['ext'] : '?');
}
}
Expand Down
2 changes: 1 addition & 1 deletion Model/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function beforeSave($options = []) {
* Update last used timestamp
*/
public function touch($addressId) {
$this->updateAll([$this->alias . '.last_used' => 'NOW()'], [$this->alias . '.id' => $addressId]);
$this->updateAllJoinless([$this->alias . '.last_used' => 'NOW()'], [$this->alias . '.id' => $addressId]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Model/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ public function updateValues() {
foreach ($currencies as $currency) {
$value = $this->CurrencyLib->convert(1, $base[$this->alias]['code'], $currency[$this->alias]['code'], 4);
if ($value !== false) {
$this->id = $currency[$this->alias]['id'];
$this->saveField('value', $value);
$id = $currency[$this->alias]['id'];
$this->saveFieldById($id, 'value', $value);
} else {
$this->log('Invalid Currency ' . $currency[$this->alias]['code'], 'warning');
}
Expand Down
10 changes: 5 additions & 5 deletions Model/MimeType.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
App::uses('DataAppModel', 'Data.Model');
App::uses('File', 'Utility');
App::uses('EmailLib', 'Tools.Lib');

class MimeType extends DataAppModel {

Expand Down Expand Up @@ -94,13 +95,13 @@ public function mimeTypeExists($ext = null) {
* could be done on every upload/download = automagic sort by priority
*
* @param string $ext
* @return void
* @return bool
*/
public function push($ext = null) {
$type = $this->mimeTypeExists($ext);
if (!empty($type)) {
$this->id = $type[$this->alias]['id'];
return $this->saveField('sort', $type[$this->alias]['sort'] + 1);
$id = $type[$this->alias]['id'];
return $this->saveFieldById($id, 'sort', $type[$this->alias]['sort'] + 1);
}
# insert this new extension
$data = ['ext' => $ext, 'name' => 'auto-added', 'sort' => 1];
Expand All @@ -110,8 +111,7 @@ public function push($ext = null) {
return false;
}
# notify admin
App::uses('EmailLib', 'Tools.Lib');
//App::import('Controller', 'Data.MimeTypes');

$this->Email = new EmailLib();
$this->Email->to(Configure::read('Config.adminEmail'), Configure::read('Config.adminEmailname'));
$this->Email->replyTo(Configure::read('Config.adminEmail'), Configure::read('Config.adminEmailname'));
Expand Down
5 changes: 2 additions & 3 deletions Model/MimeTypeImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ public function afterDelete() {

$types = $this->MimeType->find('all', ['fields' => ['id'], 'conditions' => ['mime_type_image_id' => $this->_del[$this->alias]['id']]]);
foreach ($types as $type) {
$this->MimeType->id = $type[$this->MimeType->alias]['id'];
$this->MimeType->saveField('mime_type_image_id', 0);
//pr ($type[$this->MimeType->alias]['id'].' del success');
$id = $type[$this->MimeType->alias]['id'];
$this->MimeType->saveFieldById($id, 'mime_type_image_id', 0);
}
}

Expand Down