finished converting
This commit is contained in:
parent
5f78792c53
commit
999bd7cc06
100
src/convert.php
100
src/convert.php
@ -1,100 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/*
|
||||
* Convert the old labely repeat system to the new rrule system
|
||||
*/
|
||||
|
||||
// load the config, create the connection and load the repo sepcified on the cmd line args
|
||||
// we will then have $client and $repo available
|
||||
require('setup.php');
|
||||
|
||||
//define the repeat terms
|
||||
$terms=[
|
||||
'months'=>[1=>'janurary',2=>'feburary',3=>'march',4=>'april',5=>'may',6=>'june',7=>'july',8=>'august',9=>'september',10=>'october',11=>'november',12=>'december'],
|
||||
'days'=>['MO'=>'monday','TU'=>'tuesday','WE'=>'wednesday','TH'=>'thursday','FR'=>'friday','SA'=>'saturday','SU'=>'sunday'],
|
||||
'generic'=>['daily','weekly','fortnightly','monthly','yearly']
|
||||
];
|
||||
|
||||
$callback=function($issue) use ($terms){
|
||||
if(strpos($issue->body,'RRULE: ')===false){
|
||||
echo "\n*** {$issue->number} : {$issue->title}\n\n";
|
||||
}else{
|
||||
//echo $issue->body;
|
||||
}
|
||||
};
|
||||
|
||||
foreach($terms as $name=>$values){
|
||||
foreach($values as $id=>$value){
|
||||
$repo->forIssues($callback,['labels'=>"$value/repeat"]);
|
||||
$repo->forIssues($callback,['state'=>'closed','labels'=>"$value/repeat"]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
$month=function($issue) use($terms){
|
||||
$t=getRepeatTerms($issue,$terms);
|
||||
print_r($t);
|
||||
$ms=[];
|
||||
foreach($t['months'] as $id=>$m){
|
||||
$ms[]=$id;
|
||||
}
|
||||
$ms=implode(',',$ms);
|
||||
$rrule="RRULE: FREQ=MONTHLY;INTERVAL=1;BYMONTH=$ms;BYMONTHDAY=1";
|
||||
echo "\n\n$rrule\n\n";
|
||||
|
||||
$issue->body=preg_replace("#RRULE:.*#",'',$issue->body);
|
||||
|
||||
$issue->body=$rrule."\n\n".$issue->body;
|
||||
$issue->save();
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
$ms=implode(',',$ms);
|
||||
$rrule="RRULE: FREQ=MONTHLY;INTERVAL=1;BYMONTH=$ms;BYMONTHDAY=1";
|
||||
echo "\n\n$rrule\n\n";
|
||||
|
||||
$issue->body=preg_replace("#RRULE:.*#",'',$issue->body);
|
||||
|
||||
$issue->body=$rrule."\n\n".$issue->body;
|
||||
$issue->save();
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
function getRepeatTerms($issue,$terms){
|
||||
$labels=[];
|
||||
$found=[];
|
||||
foreach($issue->labels as $label){
|
||||
$labels[]=$label->name;
|
||||
}
|
||||
print_r($labels);
|
||||
return $found;
|
||||
}
|
||||
|
||||
function countRepeatTerms($issue){
|
||||
$c=0;
|
||||
print_r($issue->labels);
|
||||
foreach($issue->labels as $label){
|
||||
if(strpos($label->name,'/repeat')){
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
return $c;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
DONE - do not not run again
|
||||
foreach($terms['months'] as $value){
|
||||
$repo->forIssues($month,['labels'=>"$value/repeat"]);
|
||||
$repo->forIssues($month,['state'=>'closed','labels'=>"$value/repeat"]);
|
||||
}
|
||||
$repo->forIssues($callback,['labels'=>"weekly/repeat"]);
|
||||
$repo->forIssues($callback,['state'=>'closed','labels'=>"weekly/repeat"]);
|
||||
$repo->forIssues($callback,['labels'=>"monthly/repeat"]);
|
||||
$repo->forIssues($callback,['state'=>'closed','labels'=>"monthly/repeat"]);
|
||||
*/
|
Loading…
Reference in New Issue
Block a user