Add a persistent 'shorturl' key to all links

All existing link will keep their permalinks.
New links will have smallhash generated with date+id.

The purpose of this is to avoid collision between links due to their creation date.
This commit is contained in:
ArthurHoaro 2016-11-28 18:24:15 +01:00
parent c3dfd89959
commit d592daea83
15 changed files with 115 additions and 91 deletions
tests/plugins

View file

@ -52,8 +52,9 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
'title' => $str,
'links' => array(
array(
'id' => 12,
'url' => $str,
'created' => DateTime::createFromFormat('Ymd_His', $date),
'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date),
)
)
);
@ -66,7 +67,14 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
// plugin data
$this->assertEquals(1, count($data['plugin_end_zone']));
$this->assertNotFalse(strpos($data['plugin_end_zone'][0], $date));
$this->assertNotFalse(strpos(
$data['plugin_end_zone'][0],
'data-isso-id="'. $data['links'][0]['id'] .'"'
));
$this->assertNotFalse(strpos(
$data['plugin_end_zone'][0],
'data-title="'. $data['links'][0]['id'] .'"'
));
$this->assertNotFalse(strpos($data['plugin_end_zone'][0], 'embed.min.js'));
}
@ -85,12 +93,14 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
'title' => $str,
'links' => array(
array(
'id' => 12,
'url' => $str,
'created' => DateTime::createFromFormat('Ymd_His', $date1),
'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date1),
),
array(
'id' => 13,
'url' => $str . '2',
'created' => DateTime::createFromFormat('Ymd_His', $date2),
'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date2),
),
)
);
@ -114,8 +124,9 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase
'title' => $str,
'links' => array(
array(
'id' => 12,
'url' => $str,
'created' => DateTime::createFromFormat('Ymd_His', $date),
'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date),
)
),
'search_term' => $str