Skip to content

Commit

Permalink
Start migration to ZF2/3
Browse files Browse the repository at this point in the history
  • Loading branch information
autowp committed Jun 19, 2016
1 parent 052cd76 commit 3073c9c
Show file tree
Hide file tree
Showing 75 changed files with 8,313 additions and 1,274 deletions.
4 changes: 2 additions & 2 deletions application/models/Cars/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ private function getSpecTable()

private static function buildYearsString(array $options)
{
$defaults = array(
$defaults = [
'begin_year' => null,
'end_year' => null,
'today' => null
);
];
$options = array_replace($defaults, $options);

$result = '';
Expand Down
6 changes: 3 additions & 3 deletions application/models/Comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private function _get($type, $item, $parentId, $userId, $perPage = 0, $page = 0)
if ($userId instanceof Users_Row) {
$userId = $userId->id;
}

if ($perPage) {

$paginator = $this->getPaginator($type, $item, $perPage, $page);
Expand Down Expand Up @@ -503,8 +503,8 @@ public function updateRepliesCount()
using(type_id, item_id, id)
set comments_messages.replies_count = __cms.count
');
return $affected;

return $affected->rowCount();
}

private function _moveMessageRecursive($parentId, $newTypeId, $newItemId)
Expand Down
45 changes: 0 additions & 45 deletions application/modules/api/controllers/ContactController.php

This file was deleted.

127 changes: 0 additions & 127 deletions application/modules/api/controllers/PictureController.php

This file was deleted.

17 changes: 6 additions & 11 deletions application/modules/default/controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public function userAction()
$uaRows = $uaTable->fetchAll(array(
'user_id = ?' => $user->id
));

$contact = new Contact();

$currentUser = $this->_helper->user()->get();
$isMe = $currentUser && ($currentUser->id == $user->id);
$inContacts = $currentUser && !$isMe && $contact->exists($currentUser->id, $user->id);
Expand All @@ -112,12 +112,7 @@ public function userAction()
'accounts' => $uaRows,
'inContacts' => $inContacts,
'canBeInContacts' => $canBeInContacts,
'contactApiUrl' => $this->_helper->url->url([
'module' => 'api',
'controller' => 'contact',
'action' => 'user',
'user_id' => $user->id
], 'default', true)
'contactApiUrl' => sprintf('/api/contacts/%d', $user->id)
));

}
Expand Down Expand Up @@ -147,15 +142,15 @@ public function picturesAction()

// СПИСОК БРЕНДОВ
$brandModel = new Brand();

$options = [
'language' => $this->_helper->language(),
'columns' => [
'img',
'pictures_count' => new Zend_Db_Expr('COUNT(distinct pictures.id)')
]
];

$rows = $brandModel->getList($options, function($select) use ($user) {
$select
->join('brands_cars', 'brands.id = brands_cars.brand_id', null)
Expand Down Expand Up @@ -207,7 +202,7 @@ public function brandpicturesAction()
if (!$user) {
return $this->_forward('notfound', 'error');
}

$language = $this->_helper->language();

$brandModel = new Brand();
Expand Down
8 changes: 4 additions & 4 deletions application/services/Telegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ public function notifyInbox($pictureId)
$router = Zend_Controller_Front::getInstance()->getRouter();

foreach ($rows as $row) {
$url = $router->assemble(array(
$url = $router->assemble([
'picture_id' => $picture->identity ? $picture->identity : $picture->id,
), 'picture', true);
], 'picture', true);

$this->sendMessage(array(
$this->sendMessage([
'text' => 'http://autowp.ru' . $url,
'chat_id' => $row['chat_id']
));
]);
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions application/services/TrafficControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,4 +443,17 @@ public function autoWhitelist()
print PHP_EOL;
}
}

public function gc()
{
$count = $this->_getMonitoringTable()->delete([
'day_date < CURDATE()'
]);

$count += $this->_getBannedTable()->delete(
'up_to < NOW()'
);

return $count;
}
}
20 changes: 18 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@
"autowp/external-login-service": "^1.0",
"zendframework/zend-uri": "^2.5",
"zendframework/zend-db": "^2.7",
"twitter/typeahead.js": "^0.11.1"
"twitter/typeahead.js": "^0.11.1",
"zendframework/zend-mvc": "^3.0",
"zendframework/zend-mvc-i18n": "^1.0",
"zendframework/zend-mvc-plugin-flashmessenger": "^1.0",
"zendframework/zend-i18n": "^2.7",
"zendframework/zend-paginator": "^2.7",
"zendframework/zend-view": "^2.7",
"zendframework/zend-mvc-console": "^1.1",
"zendframework/zend-form": "^2.9",
"zendframework/zend-captcha": "^2.5"
},
"authors": [
{
Expand All @@ -47,7 +56,14 @@
"Application\\Model\\": "application/models",
"Application\\Model\\DbTable\\": "application/models/DbTable",
"Application\\Service\\": "application/services"
}
},
"classmap": [
"application/models/",
"application/forms/",
"application/services/",
"library/Project/Form/Element/",
"library/Project/Telegram"
]
},
"require-dev": {
"phpunit/PHPUnit": "~4.0"
Expand Down
Loading

0 comments on commit 3073c9c

Please sign in to comment.