-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting.php
More file actions
29 lines (25 loc) · 827 Bytes
/
Copy pathtesting.php
File metadata and controls
29 lines (25 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
include("config.php");
include("Const.php");
include("ActiveRecordInterface.php");
include("ActiveRecord.php");
include("Posts.php");
include("LitresData.php");
$_SESSION['pdo'] = $pdo;
$liresDataArr = LitresData::model()->findAll();
if(is_null($liresDataArr)){
throw new Exception("Нет книг для импорта");
}
foreach ($liresDataArr as $key => $liresData) {
// Если книга не была еще импортирована
if(is_null($liresData->local_book_id)){
// Книга еще не была вставлена - новая книга
if(is_null($liresData->local_book_id_litres_catalog)){
$post = Posts::model();
$post->setData($liresData);
$post->save();
} else { // Книга уже есть в базе, осталось обновить
}
}
}
session_destroy();