Improvements to Echoarea Import, area names are now uppercase and descriptions use ucfirst()
This commit is contained in:
parent
a87cf875e4
commit
c59f8ee0ed
@ -52,13 +52,7 @@ class EchoareaImport implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
// Get the file from the host
|
$fh = fopen($this->file,'r');
|
||||||
$file = $this->getFileFromHost('',self::importkey,$this->file);
|
|
||||||
Log::debug(sprintf('%s:Loading file [%s] (%s).',static::LOGKEY,$file,getcwd()));
|
|
||||||
$lines = $this->getFileLines($file);
|
|
||||||
Log::debug(sprintf('%s:Processing [%d] lines.',static::LOGKEY,$lines));
|
|
||||||
|
|
||||||
$fh = fopen($file,'r');
|
|
||||||
|
|
||||||
$p = $c = 0;
|
$p = $c = 0;
|
||||||
while (! feof($fh)) {
|
while (! feof($fh)) {
|
||||||
@ -73,16 +67,16 @@ class EchoareaImport implements ShouldQueue
|
|||||||
|
|
||||||
$c++;
|
$c++;
|
||||||
|
|
||||||
list($area,$description) = preg_split('/[\s|\t]+/',$line,2);
|
if (str_contains($line,' '))
|
||||||
|
list($area,$description) = preg_split('/[\s|\t]+/',$line,2);
|
||||||
if ($this->do->echoareas->pluck('name')->search($area) !== FALSE) {
|
else {
|
||||||
Log::info(sprintf('%s: Area [%s] already exists.',self::LOGKEY,$area));
|
$area = $line;
|
||||||
continue;
|
$description = '[No Description]';
|
||||||
}
|
}
|
||||||
|
|
||||||
$o = new Echoarea;
|
$o = Echoarea::whereRaw(sprintf("LOWER(name)='%s'",strtolower($area)))->firstOrNew();
|
||||||
$o->name = $area;
|
$o->name = strtoupper($area);
|
||||||
$o->description = ($this->prefix ?: '').$description;
|
$o->description = ($this->prefix.' ' ?: '').ucfirst($description);
|
||||||
$o->active = TRUE;
|
$o->active = TRUE;
|
||||||
$o->show = TRUE;
|
$o->show = TRUE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user