Merge branch 'develop' of github.com:tainacan/tainacan into develop

This commit is contained in:
Jacson Passold 2018-06-04 22:22:50 -03:00
commit e817d2761b
21 changed files with 395 additions and 60 deletions

View File

@ -0,0 +1,123 @@
<template>
<div>
<div class="columns is-multiline tnc-advanced-search-container">
<div
v-for="searchField in totalSearchMetadata"
:key="searchField"
class="field column is-12 tainacan-form">
<b-field
class="columns"
grouped>
<b-field class="column is-one-fifth">
<b-select
@input="addToAdvancedSearchQuery">
<option
v-for="(metadata, key) in metadataList"
v-if="metadata.enabled"
:value="metadata.id"
:key="key"
>{{ metadata.name }}</option>
</b-select>
</b-field>
<b-field class="column is-two-thirds">
<b-input
@input="addToAdvancedSearchQuery"/>
</b-field>
<b-field class="column is-one-fifth">
<b-select
@input="addToAdvancedSearchQuery">
<option
v-for="(opt, key) in compare"
:value="key"
:key="key"
>{{ opt }}</option>
</b-select>
</b-field>
</b-field>
</div>
<div
:style="{'padding-left': '25px !important'}"
class="field column is-12">
<div class="is-inline">
<b-icon
icon="plus-circle"
size="is-small"
type="is-info"/>
<a
@click="addSearchMetadata"
class="is-info is-small">
Adicionar mais um campo de busca</a>
</div>
</div>
<div class="column">
<div class="field is-grouped is-pulled-right">
<p class="control">
<button
@click="clearSearch"
class="button is-outlined">Limpar busca</button>
</p>
<p class="control">
<button
@click="searchAdvanced"
class="button is-secondary">Buscar</button>
</p>
</div>
</div>
<pre>{{ metadataIds }} {{ toCompare }}</pre>
</div>
</div>
</template>
<script>
export default {
name: "AdvancedSearch",
props: {
metadataList: Array,
},
data(){
return {
compare: {'=':'Igual', '!=':'Diferente', 'IN':'Contém', 'NOT IN':'Não Contém'},
totalSearchMetadata: 1,
advancedSearchQuery: {},
}
},
methods: {
addSearchMetadata(){
this.totalSearchMetadata++;
},
clearSearch(){
this.totalSearchMetadata = 1;
},
searchAdvanced(){
},
addToAdvancedSearchQuery(optionValue){
console.log(optionValue);
},
}
}
</script>
<style lang="scss">
@import '../../scss/_variables.scss';
.tnc-advanced-search-container {
padding-top: 47px;
padding-right: $page-side-padding;
padding-left: $page-side-padding;
padding-top: 47px;
.column {
padding: 0 0.3rem 0.3rem !important;
}
}
</style>

View File

@ -195,14 +195,17 @@
if (formNotSaved) { if (formNotSaved) {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_category_not_saved'), message: this.$i18n.get('info_warning_category_not_saved'),
onConfirm: () => { onConfirm: () => {
next(); next();
}, },
cancelText: this.$i18n.get('cancel'), icon: 'alert-circle',
confirmText: this.$i18n.get('continue'), hasIcon: true,
type: 'is-secondary' cancelText: this.$i18n.get('cancel'),
}); confirmText: this.$i18n.get('continue'),
type: 'is-success'
});
} else { } else {
next() next()
} }

View File

@ -301,6 +301,7 @@
class="control" class="control"
custom> custom>
<b-checkbox <b-checkbox
v-if="registeredViewModes[viewMode] != undefined"
@input="updateViewModeslist(viewMode)" @input="updateViewModeslist(viewMode)"
:value="checkIfViewModeEnabled(viewMode)"> :value="checkIfViewModeEnabled(viewMode)">
{{ registeredViewModes[viewMode].label }} {{ registeredViewModes[viewMode].label }}
@ -326,6 +327,7 @@
@focus="clearErrors('default_view_mode')"> @focus="clearErrors('default_view_mode')">
<option <option
v-for="(viewMode, index) of form.enabled_view_modes" v-for="(viewMode, index) of form.enabled_view_modes"
v-if="registeredViewModes[viewMode] != undefined"
:key="index" :key="index"
:value="viewMode">{{ registeredViewModes[viewMode].label }} :value="viewMode">{{ registeredViewModes[viewMode].label }}
</option> </option>

View File

@ -676,14 +676,17 @@ export default {
beforeRouteLeave ( to, from, next ) { beforeRouteLeave ( to, from, next ) {
if (this.item.status == 'auto-draft') { if (this.item.status == 'auto-draft') {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_item_not_saved'), message: this.$i18n.get('info_warning_item_not_saved'),
onConfirm: () => { onConfirm: () => {
next(); next();
}, },
cancelText: this.$i18n.get('cancel'), icon: 'alert-circle',
confirmText: this.$i18n.get('continue'), hasIcon: true,
type: 'is-secondary' cancelText: this.$i18n.get('cancel'),
}); confirmText: this.$i18n.get('continue'),
type: 'is-success'
});
} else { } else {
next() next()
} }

View File

@ -180,6 +180,7 @@
}, },
deleteOneCategory(categoryId) { deleteOneCategory(categoryId) {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_category_delete'), message: this.$i18n.get('info_warning_category_delete'),
onConfirm: () => { onConfirm: () => {
this.deleteCategory(categoryId) this.deleteCategory(categoryId)
@ -205,11 +206,15 @@
// queue: true // queue: true
// }); // });
}); });
} },
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
}); });
}, },
deleteSelectedCategories() { deleteSelectedCategories() {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_selected_categories_delete'), message: this.$i18n.get('info_warning_selected_categories_delete'),
onConfirm: () => { onConfirm: () => {
@ -237,7 +242,10 @@
} }
} }
this.allCategoriesOnPageSelected = false; this.allCategoriesOnPageSelected = false;
} },
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
}); });
}, },
goToCategoryPage(categoryId) { goToCategoryPage(categoryId) {

View File

@ -230,6 +230,7 @@ export default {
}, },
deleteOneCollection(collectionId) { deleteOneCollection(collectionId) {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_collection_delete') : this.$i18n.get('info_warning_collection_trash'), message: this.isOnTrash ? this.$i18n.get('info_warning_collection_delete') : this.$i18n.get('info_warning_collection_trash'),
onConfirm: () => { onConfirm: () => {
this.deleteCollection({ collectionId: collectionId, isPermanently: this.isOnTrash }) this.deleteCollection({ collectionId: collectionId, isPermanently: this.isOnTrash })
@ -254,11 +255,15 @@ export default {
// queue: true // queue: true
// }) // })
}); });
} },
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
}); });
}, },
deleteSelectedCollections() { deleteSelectedCollections() {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_collections_delete') : this.$i18n.get('info_warning_selected_collections_trash'), message: this.isOnTrash ? this.$i18n.get('info_warning_selected_collections_delete') : this.$i18n.get('info_warning_selected_collections_trash'),
onConfirm: () => { onConfirm: () => {
@ -286,7 +291,10 @@ export default {
} }
} }
this.allCollectionsOnPageSelected = false; this.allCollectionsOnPageSelected = false;
} },
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
}); });
}, },
goToCollectionPage(collectionId) { goToCollectionPage(collectionId) {

View File

@ -195,15 +195,18 @@ export default {
} }
if ((this.openedFieldId != '' && this.openedFieldId != undefined) || hasUnsavedForms ) { if ((this.openedFieldId != '' && this.openedFieldId != undefined) || hasUnsavedForms ) {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_fields_not_saved'), message: this.$i18n.get('info_warning_fields_not_saved'),
onConfirm: () => { onConfirm: () => {
this.onEditionCanceled(); this.onEditionCanceled();
next(); next();
}, },
cancelText: this.$i18n.get('cancel'), icon: 'alert-circle',
confirmText: this.$i18n.get('continue'), hasIcon: true,
type: 'is-secondary' cancelText: this.$i18n.get('cancel'),
}); confirmText: this.$i18n.get('continue'),
type: 'is-success'
});
} else { } else {
next() next()
} }

View File

@ -222,15 +222,18 @@ export default {
} }
if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) { if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_filters_not_saved'), message: this.$i18n.get('info_warning_filters_not_saved'),
onConfirm: () => { onConfirm: () => {
this.onEditionCanceled(); this.onEditionCanceled();
next(); next();
}, },
cancelText: this.$i18n.get('cancel'), icon: 'alert-circle',
confirmText: this.$i18n.get('continue'), hasIcon: true,
type: 'is-secondary' cancelText: this.$i18n.get('cancel'),
}); confirmText: this.$i18n.get('continue'),
type: 'is-success'
});
} else { } else {
next() next()
} }

View File

@ -214,6 +214,7 @@ export default {
}, },
deleteOneItem(itemId) { deleteOneItem(itemId) {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'), message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'),
onConfirm: () => { onConfirm: () => {
this.deleteItem({ itemId: itemId, isPermanently: this.isOnTrash }) this.deleteItem({ itemId: itemId, isPermanently: this.isOnTrash })
@ -239,11 +240,15 @@ export default {
// queue: true // queue: true
// }) // })
}); });
} },
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
}); });
}, },
deleteSelectedItems() { deleteSelectedItems() {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'), message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'),
onConfirm: () => { onConfirm: () => {
@ -275,7 +280,10 @@ export default {
} }
} }
this.allItemsOnPageSelected = false; this.allItemsOnPageSelected = false;
} },
icon: 'alert-circle',
hasIcon: true,
type: 'is-success'
}); });
}, },
goToItemPage(item) { goToItemPage(item) {

View File

@ -213,13 +213,16 @@ export default {
// Checks if user is deleting a term with unsaved info. // Checks if user is deleting a term with unsaved info.
if (term.id == 'new' || !term.saved || term.opened) { if (term.id == 'new' || !term.saved || term.opened) {
this.$dialog.confirm({ this.$dialog.confirm({
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_terms_not_saved'), message: this.$i18n.get('info_warning_terms_not_saved'),
onCancel: () => { return }, onCancel: () => { return },
onConfirm: () => { this.removeTerm(term);}, onConfirm: () => { this.removeTerm(term); },
cancelText: this.$i18n.get('cancel'), icon: 'alert-circle',
confirmText: this.$i18n.get('continue'), hasIcon: true,
type: 'is-secondary' cancelText: this.$i18n.get('cancel'),
}); confirmText: this.$i18n.get('continue'),
type: 'is-success'
});
} else{ } else{
this.removeTerm(term); this.removeTerm(term);
} }

View File

@ -20,7 +20,7 @@
<div class="control has-icons-right is-small is-clearfix"> <div class="control has-icons-right is-small is-clearfix">
<input <input
autocomplete="on" autocomplete="on"
:placeholder="$i18n.get('instruction_search_repository')" :placeholder="$i18n.get('instruction_search')"
class="input is-small" class="input is-small"
type="search" type="search"
v-model="searchTerm"> v-model="searchTerm">
@ -28,7 +28,7 @@
<i class="mdi mdi-magnify" /> <i class="mdi mdi-magnify" />
</span> </span>
</div> </div>
<a href="">{{ $i18n.get('advanced_search') }}</a> <a @click.prevent="openAdvancedSearchComponent">{{ $i18n.get('advanced_search') }}</a>
</span> </span>
<a <a
class="level-item" class="level-item"
@ -50,6 +50,13 @@ export default {
searchTerm: '' searchTerm: ''
} }
}, },
methods: {
openAdvancedSearchComponent(){
console.log('Called here', this.$route.meta);
this.$set(this.$route.meta, 'openAdvancedSearch', !this.$route.meta.openAdvancedSearch);
console.log('Called here', this.$route.meta);
}
},
props: { props: {
isMenuCompressed: false isMenuCompressed: false
} }
@ -105,7 +112,7 @@ export default {
color: $tertiary; color: $tertiary;
} }
.search-area { .search-area {
display: none;//display: flex; display: flex;
align-items: center; align-items: center;
margin-right: 36px; margin-right: 36px;

View File

@ -50,7 +50,7 @@ const routes = [
] ]
}, },
{ path: '/items', name: 'ItemsPage', component: ItemsPage, meta: {title: i18nGet('title_items_page'), icon: 'file-multiple'} }, { path: '/items', name: 'ItemsPage', component: ItemsPage, meta: {title: i18nGet('title_items_page'), icon: 'file-multiple', openAdvancedSearch: false} },
{ path: '/items/new', name: 'ItemCreationForm', component: ItemEditionForm, meta: {title: i18nGet('title_create_item'), icon: 'file-multiple'} }, { path: '/items/new', name: 'ItemCreationForm', component: ItemEditionForm, meta: {title: i18nGet('title_create_item'), icon: 'file-multiple'} },
{ path: '/filters', name: 'FiltersPage', component: FiltersPage, meta: {title: i18nGet('title_repository_filters_page'), icon: 'filter'} }, { path: '/filters', name: 'FiltersPage', component: FiltersPage, meta: {title: i18nGet('title_repository_filters_page'), icon: 'filter'} },

View File

@ -44,7 +44,9 @@
</button> </button>
</p> </p>
</b-field> </b-field>
<!-- <a class="is-size-7 is-secondary is-pulled-right">Busca avançada</a> --> <a
@click.prevent="openAdvancedSearchComponent"
class="is-size-7 is-secondary is-pulled-right">{{ $i18n.get('advanced_search') }}</a>
<h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3> <h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3>
<a <a
@ -241,8 +243,10 @@
</div> </div>
<!-- ADVANCED SEARCH <!-- ADVANCED SEARCH -->
<advanced-search /> --> <advanced-search
v-if="openAdvancedSearch"
:metadata-list="fields" />
<!-- --------------- --> <!-- --------------- -->
@ -332,7 +336,7 @@
import ItemsList from '../../components/lists/items-list.vue'; import ItemsList from '../../components/lists/items-list.vue';
import FiltersItemsList from '../../components/search/filters-items-list.vue'; import FiltersItemsList from '../../components/search/filters-items-list.vue';
import Pagination from '../../components/search/pagination.vue' import Pagination from '../../components/search/pagination.vue'
// import AdvancedSearch from '../../components/advanced-search/advanced-search.vue'; import AdvancedSearch from '../../components/advanced-search/advanced-search.vue';
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
export default { export default {
@ -361,6 +365,10 @@
enabledViewModes: Object // Used only on theme enabledViewModes: Object // Used only on theme
}, },
computed: { computed: {
openAdvancedSearch(){
console.log('Called here', this.$route.meta);
return this.$route.meta.openAdvancedSearch;
},
items() { items() {
return this.getItems(); return this.getItems();
}, },
@ -396,7 +404,7 @@
ItemsList, ItemsList,
FiltersItemsList, FiltersItemsList,
Pagination, Pagination,
// AdvancedSearch, AdvancedSearch,
}, },
watch: { watch: {
tableFields() { tableFields() {
@ -428,6 +436,11 @@
'getViewMode', 'getViewMode',
'getTotalItems' 'getTotalItems'
]), ]),
openAdvancedSearchComponent(){
console.log('Called here', this.$route.meta);
this.$set(this.$route.meta, 'openAdvancedSearch', !this.$route.meta.openAdvancedSearch);
console.log('Called here', this.$route.meta);
},
updateSearch() { updateSearch() {
this.$eventBusSearch.setSearchQuery(this.futureSearchQuery); this.$eventBusSearch.setSearchQuery(this.futureSearchQuery);
}, },

View File

@ -1,4 +1,3 @@
// Tainacan modals // Tainacan modals
.tainacan-modal-title { .tainacan-modal-title {
h1, h2 { h1, h2 {
@ -35,9 +34,64 @@
padding: 80px 0em 0.4em 0em !important; padding: 80px 0em 0.4em 0em !important;
} }
} }
// Bulma modals customized for Tainacan
.dialog{
.modal-background {
background-color: rgba(0, 0, 0, 0.70);
}
.modal-card {
background-color: $modal-backgound-color;
color: $secondary;
border-radius: 10px;
.modal-background { .modal-card-head, .modal-card-body, .modal-card-foot {
background-color: rgba(0, 0, 0, 0.70); background-color: $modal-backgound-color;
color: $secondary;
border: none;
}
.modal-card-head {
p { color: $secondary; }
font-weight: normal;
padding: 30px 35px 0px 35px;
}
.modal-card-body {
padding: 16px 35px;
i {
color: white !important;
&::before {
background-color: $danger;
border-radius: 55px;
display: initial;
}
}
}
.modal-card-foot {
justify-content: space-between;
padding: 0px 35px 30px 35px;
.button {
border-radius: 6px !important;
font-weight: normal;
padding: 2px 15px !important;
margin-top: 0px !important;
margin-bottom: 0px !important;
height: inherit !important;
box-shadow: none !important;
display: inline-flex !important;
cursor: pointer;
font-size: 13px !important;
}
.button.is-success {
border: none;
}
.button:not(.is-success) {
background-color: white;
color: $tertiary;
border: 1px solid $gray-light;
}
}
}
} }
// WordPress Media Modal customization // WordPress Media Modal customization

View File

@ -18,6 +18,7 @@ $primary-darker: darken($primary-dark, 5%);
$success: #25a189; $success: #25a189;
$success-invert: findColorInvert($success); $success-invert: findColorInvert($success);
$modal-backgound-color: #bfd8dd;
$separator-color: #2b98a4; $separator-color: #2b98a4;
$tainacan-input-color: #1d1d1d; $tainacan-input-color: #1d1d1d;
$tainacan-input-background: #e5e5e5; $tainacan-input-background: #e5e5e5;

View File

@ -197,6 +197,8 @@ return [
'label_default_view_mode' => __( 'Default view mode', 'tainacan' ), 'label_default_view_mode' => __( 'Default view mode', 'tainacan' ),
'label_enabled_view_modes' => __( 'Enabled view modes', 'tainacan' ), 'label_enabled_view_modes' => __( 'Enabled view modes', 'tainacan' ),
'label_view_modes_available' => __( 'View modes available on theme', 'tainacan' ), 'label_view_modes_available' => __( 'View modes available on theme', 'tainacan' ),
'label_warning' => __( 'Warning', 'tainacan' ),
'label_error' => __( 'Erro', 'tainacan' ),
// Instructions. More complex sentences to guide user and placeholders // Instructions. More complex sentences to guide user and placeholders
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ), 'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),

View File

@ -327,7 +327,7 @@ class REST_Filters_Controller extends REST_Controller {
$item_arr['enabled'] = $item->get_enabled_for_collection(); $item_arr['enabled'] = $item->get_enabled_for_collection();
} }
$item_arr['filter_type_object'] = $item->get_filter_type_object()->_toArray(); $item_arr['filter_type_object'] = $item->get_filter_type_object() ? $item->get_filter_type_object()->_toArray() : $item->get_filter_type_object();
return $item_arr; return $item_arr;
} }

View File

@ -4,7 +4,7 @@
<div v-if="type === 'date'"> <div v-if="type === 'date'">
<b-datepicker <b-datepicker
:placeholder="$i18n.get('label_selectbox_init')" :placeholder="$i18n.get('label_selectbox_init')"
:class="{'has-content': date_init !== undefined && date_init !== ''}" :class="{'has-content': date_init != undefined && date_init != ''}"
v-model="date_init" v-model="date_init"
size="is-small" size="is-small"
@focus="isTouched = true" @focus="isTouched = true"
@ -12,7 +12,7 @@
icon="calendar-today"/> icon="calendar-today"/>
<b-datepicker <b-datepicker
:placeholder="$i18n.get('label_selectbox_init')" :placeholder="$i18n.get('label_selectbox_init')"
:class="{'has-content': date_end !== undefined && date_end !== ''}" :class="{'has-content': date_end != undefined && date_end != ''}"
v-model="date_end" v-model="date_end"
size="is-small" size="is-small"
@input="validate_values()" @input="validate_values()"
@ -25,7 +25,7 @@
class="columns" class="columns"
v-else> v-else>
<b-input <b-input
:class="{'has-content': value_init !== undefined && value_init !== ''}" :class="{'has-content': value_init != undefined && value_init != ''}"
size="is-small" size="is-small"
type="number" type="number"
step="any" step="any"
@ -33,7 +33,7 @@
class="column" class="column"
v-model="value_init"/> v-model="value_init"/>
<b-input <b-input
:class="{'has-content': value_end !== undefined && value_end !== ''}" :class="{'has-content': value_end != undefined && value_end != ''}"
size="is-small" size="is-small"
type="number" type="number"
step="any" step="any"

View File

@ -264,7 +264,7 @@ abstract class Importer {
*/ */
public function fetch_from_remote( $url ){ public function fetch_from_remote( $url ){
$tmp = wp_remote_get( $url ); $tmp = wp_remote_get( $url );
if( isset( $tmp['body'] ) ){ if( !is_wp_error($tmp) && isset( $tmp['body'] ) ){
$file = fopen( $this->get_id().'.txt', 'w' ); $file = fopen( $this->get_id().'.txt', 'w' );
fwrite( $file, $tmp['body'] ); fwrite( $file, $tmp['body'] );
fclose( $file ); fclose( $file );

90
src/importer/import.php Normal file
View File

@ -0,0 +1,90 @@
<?php
class ScriptTainacanOld {
var $step = 0;
var $url = '';
/**
* start the execution
*/
function __construct($argv) {
$this->parse_args($argv);
$this->run();
}
/**
* parse args from and set the attributs
* 1 - Old Tainacan url (required)
*/
function parse_args($argv) {
if (!is_array($argv))
return;
if (isset($argv[1])) {
if (filter_var($argv[1], FILTER_VALIDATE_URL)) {
$this->url = $argv[1];
}
}
if (isset($argv[2])) {
if (is_numeric($argv[2])) {
$this->step = $argv[2];
} else {
$this->run = '';
}
}
}
/**
* echo message in prompt line
*/
function log($msg) {
echo $msg . PHP_EOL;
}
function run() {
$start = $partial = microtime(true);
// Avoid warnings
$_SERVER['SERVER_PROTOCOL'] = "HTTP/1.1";
$_SERVER['REQUEST_METHOD'] = "GET";
define( 'WP_USE_THEMES', false );
define( 'SHORTINIT', false );
require( dirname(__FILE__) . '/../../../../wp-blog-header.php' );
$old_tainacan = new \Tainacan\Importer\Old_Tainacan();
$id = $old_tainacan->get_id();
$_SESSION['tainacan_importer'][$id]->set_url($url);
$_SESSION['tainacan_importer'][$id]->set_repository();
while (!$_SESSION['tainacan_importer'][$id]->is_finished()){
$_SESSION['tainacan_importer'][$id]->run();
}
$scripttime = microtime(true) - $start;
$this->log("==========================================================");
$this->log("==========================================================");
$this->log("=== Fim do script. Tempo de execução {$scripttime}s");
$this->log("==========================================================");
$this->log("==========================================================");
}
}
$x = new ScriptTainacanOld($argv);

View File

@ -55,6 +55,10 @@ class ImporterTests extends TAINACAN_UnitTestCase {
$_SESSION['tainacan_importer'][$id]->run(); $_SESSION['tainacan_importer'][$id]->run();
} }
$Tainacan_Collections = \Tainacan\Repositories\Collections::get_instance();
$collections = $Tainacan_Collections->fetch([], 'OBJECT');
$this->assertEquals(3, $collections, 'total collection in this url does not match');
$this->assertTrue(true); $this->assertTrue(true);
}*/ }*/