Code

Replaced in_array calls for gosa-plugins
[gosa.git] / gosa-plugins / fai / admin / fai / class_faiDiskEntry.inc
1 <?php
3 class faiDiskEntry extends plugin
4 {
5   /* attribute list for save action */
6   var $ignore_account= TRUE;
7   var $attributes   = array("DISKcn","DISKdescription");
8   var $UsedAttrs            = array("cn","description","FAIpartitionType",
9       "FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
10       "FAIfsTuneOptions", "FAIfsCreateOptions", "FAImountOptions",
11       "FAIfsOptions","FAIpartitionFlags","FAIdiskOption");
13   var $objectclasses= array();
15   var $DISKcn              = "";
16   var $DISKdescription     = "";
17   var $DISKFAIdiskOptions  = "";
18   
19   var $partitions          = array();
20   var $is_edit             = false;
21   var $old_cn              = "";
22   var $fstabkey            = "device";
23   var $disklabel           = "msdos";
24   var $FAIstate            = "";
25   var $FAIdiskType         = "disk";
26   
27   var $lvmDevices          = array();
29   function faiDiskEntry (&$config, $dn= NULL,$parent,$disk,$type)
30   {
31     plugin::plugin ($config, $dn);
32   
33     // Set default attributes 
34     $this->parent = $parent;
35     $this->FAIdiskType = $type;
37     // If disk is not empty, then we are going to edit 
38     //  an existing disk, load disk info now. 
39     if($disk){
41       // Get devices used in volume base disks.
42       if(isset($disk['FAIlvmDevice'])){
43         $this->lvmDevices = $disk['FAIlvmDevice'];
44       }
46       // Load default attributes 
47       $this->DISKcn          = $disk['cn'];
48       $this->DISKdescription = $disk['description'];
49       $this->is_edit         = true;
50       $this->old_cn          = $disk['cn'];
52       // Load partition info 
53       foreach($disk['partitions'] as $values){
55         $name = $values['FAIpartitionNr'];
57         // Load partition attributes  
58         $disk['partitions'][$name]['old_cn']= $disk['partitions'][$name]['cn'];
59         $disk['partitions'][$name]['FAIdiskType']= $this->FAIdiskType;
60         foreach($this->UsedAttrs as $attr){
61           if(!isset($values[$attr])){
62             $disk['partitions'][$name][$attr]="";  
63           }
64         }
66         if (preg_match('/^_/', $disk['partitions'][$name]['FAIfsType'])){
67           $disk['partitions'][$name]['FAIfsType']= 
68             preg_replace('/^_/', '', $disk['partitions'][$name]['FAIfsType']);
69         }
70       }
72       $this->partitions      = $disk['partitions'];
74       /* Load FAIdiskOptions.
75        * Some options are disk related and others are used for partitions.
76        *  - fstabkey    -> disk
77        *  - disklabel   -> disk
78        *  - bootable    -> partition
79        *  - preserve    -> partition
80        *  - resize      -> partition
81        */
82       if (isset($disk['FAIdiskOption'])){
83         foreach($disk['FAIdiskOption'] as $option) {
85           // Get fstab key  
86           if (preg_match("/fstabkey:(device|label|uuid)/", $option)){
87             $this->fstabkey= preg_replace("/^.*fstabkey:(device|label|uuid).*$/", "$1", $option);
88             continue;
89           }
91           // Get disk label
92           if (preg_match("/disklabel:(msdos|gpt)/", $option)){
93             $this->disklabel= preg_replace("/^.*disklabel:(msdos|gpt).*$/", "$1", $option);
94             continue;
95           }
97           // Load bootable flag for partitions 
98           if (preg_match("/^bootable:/", $option)){
99             $bootable = explode(",", trim(preg_replace("/^bootable:/","",$option),","));
100             foreach($bootable as $bootflag){
101               if(isset($this->partitions[$bootflag])){
102                 $this->partitions[$bootflag]['bootable'] = TRUE;  
103               }
104             }
105             continue;
106           }
108           // Load resize flag for partitions 
109           if (preg_match("/^resize:/", $option)){
110             $resize = explode(",", trim(preg_replace("/^resize:/","",$option),","));
111             foreach($resize as $id){
112               if(isset($this->partitions[$id])){
113                 $this->partitions[$id]['resize'] = TRUE;  
114               }
115             }
116             continue;
117           }
119           // Load preserve_always flag for partitions 
120           if (preg_match("/^preserve_always:/", $option)){
121             $preserve = explode(",", trim(preg_replace("/^preserve_always:/","",$option),","));
122             foreach($preserve as $presflag){
123               if(isset($this->partitions[$presflag])){
124                 $this->partitions[$presflag]['preserve'] = TRUE;  
125                 $this->partitions[$presflag]['preserveType'] = 'always';  
126               }
127             }
128             continue;
129           }
131           // Load preserve_reinstall flag for partitions 
132           if (preg_match("/^preserve_reinstall:/", $option)){
133             $preserve = explode(",", trim(preg_replace("/^preserve_reinstall:/","",$option),","));
134             foreach($preserve as $presflag){
135               if(isset($this->partitions[$bootflag])){
136                 $this->partitions[$presflag]['preserve'] = TRUE;  
137                 $this->partitions[$presflag]['preserveType'] = 'reinstall'; 
138               } 
139             }
140             continue;
141           }
142         }
143       } else {
144         $this->fstabkey= "device";
145       }
146     }
147   }
150   function execute()
151   {
152     /* Call parent execute */
153     plugin::execute();
155     // Fill templating stuff
156     $smarty     = get_smarty();
157     $s_action   = "";
158     $s_entry    = "";
159     $display    = "";
161     // Add partition to lvm compilation.
162     if(isset($_POST['addLvmPartition']) && isset($_POST['lvmPartitionAdd'])){
163       $name = get_post('lvmPartitionAdd');
164       $this->lvmDevices[$name] = $name;
165     }
167     // Remove partition from lvm compilation.
168     if(isset($_POST['delLvmPartition']) && isset($_POST['physicalPartition'])){
169       $names = $_POST['physicalPartition'];
170       foreach($names as $name){
171         if(isset($this->lvmDevices[$name])){
172           unset($this->lvmDevices[$name]);
173         }
174       }
175     }
177     /* Check all Posts if there is something usefull for us,
178      * For example : Delete is posted as Delete_1 
179      * The number specifies the index we want to delete
180      */
181     foreach($_POST as $name => $value){
182       if((preg_match("/RemovePartition_/",$name)) && 
183           $this->acl_is_removeable() && 
184           !preg_match("/freeze/i",$this->FAIstate)){
185         $tmp = explode("_",$name);
186         $this->removePartition($tmp[1]);
187         break;
188       }
189       if(preg_match("/^EditPartition_/",$name)){
190         $id = preg_replace("/^EditPartition_/","",$name);
191         $id = preg_replace("/_.*$/","",$id);
192         if(isset($this->partitions[$id])){
193           $this->dialog = new faiPartition($this->config,$this->partitions[$id], $this,$this->FAIdiskType);
194           break;
195         }
196       } 
197     }
199     /* Act on _GET edit request
200      */
201     if(isset($_GET['act']) && $_GET['act'] == "editPart" && isset($_GET['id'])){
202       $id = $_GET['id'];
203       if(isset($this->partitions[$id])){
204         $this->dialog = new faiPartition($this->config,$this->partitions[$id], $this,$this->FAIdiskType);
205       }
206     }
208     /* Create a new partition for this disk.
209      */
210     if(isset($_POST['AddPartition']) && !preg_match("/freeze/i",$this->FAIstate)){
211       $this->dialog = new faiPartition($this->config, array(), $this,$this->FAIdiskType);
212     }
214     /* Handle partition dialogs.
215      */
216     if($this->dialog instanceOf plugin && isset($_POST['PartitionCancel'])){
217       $this->dialog = null;
218     }
219     if($this->dialog instanceOf plugin && isset($_POST['PartitionSave'])){
220       $this->dialog->save_object();
222       // Validate new partition
223       $new_partition = $this->dialog->save(); 
224       $msgs = $this->dialog->check();
225       $msgs = array_merge($msgs,$this->check_disks($new_partition));
227       if(!count($msgs)){
228         $this->updatePartition($new_partition);
229         $this->dialog = null;
230       }else{
231         msg_dialog::displayChecks($msgs);
232       }
233     }
234     if($this->dialog instanceOf plugin){
235       $this->dialog->save_object();
236       return($this->dialog->execute());
237     }
239     // Assign checkbox related values.
240     foreach($this->attributes as $attrs){
241       $smarty->assign($attrs,$this->$attrs);
242       if($this->$attrs){
243         $smarty->assign($attrs."CHK"," ");
244       }else{
245         $smarty->assign($attrs."CHK"," disabled ");
246       }
247     }
249     // Assign disk info to smarty.
250     $smarty->assign("setup", $this->generateParts());
251     $smarty->assign("sub_object_is_createable",$this->acl_is_createable());
252     $smarty->assign("freeze",preg_match("/freeze/i",$this->FAIstate));
253     $smarty->assign("fstabkeys", array("device" => _("Device"), "label" => _("Label"), "uuid" => _("UUID")));
254     $smarty->assign("disklabels", array("msdos" => "MSDOS", "gpt" => "GPT"));
255     $smarty->assign("fstabkey", $this->fstabkey);
256     $smarty->assign("disklabel", $this->disklabel);
257     $smarty->assign("FAIdiskType", $this->FAIdiskType);
258     $smarty->assign("plist", $this->getPartitionList());
259     $smarty->assign("physicalPartitionList", $this->getAvailablePartitions());
261     foreach($this->attributes as $attr){
262       $smarty->assign($attr,$this->$attr);
263     }
265     // Assign partitions
266     $tmp = $this->plInfo();
267     $sacl = "";
268     foreach($tmp['plProvidedAcls'] as $name => $translated){
269       $acl = $this->getacl($name, preg_match("/freeze/i",$this->FAIstate));
270       $smarty->assign($name."ACL",$acl);
271     }
272    
273     $display.= $smarty->fetch(get_template_path('faiDiskEntry.tpl', TRUE));
274     return($display);
275   }
278   /* Creates a human readable list, that contains all physical 
279    *  devices that are used by the volume group.
280    * This list will then be displayed in a html select box.
281    * (lvm)
282    */
283   function getPartitionList()
284   {
285     $divlist = new divSelectBox("RaidList");
287     /* Create a list of all available disks and partitions. 
288      * This list will then be used to display detailed info.
289      */
290     $disks = $this->parent->disks;
291     foreach($disks as $dname => $disk){
293       // Skip currently edited disk 
294       if($disk['cn'] == $this->old_cn) continue;
295    
296       // Add disk 
297       $objs[$dname] = $disk;
299       // Add disk partitions
300       foreach($disk['partitions'] as $id => $part){
301         $part['parentDisk'] = $disk;
302         $objs[$part['cn']] = $part;
303       }
304     }
306     // Attach current disk setup to the details list.
307     $data = $this->save();
308     $objs[$data['cn']] = $data;
309     foreach($data['partitions'] as $part){
310       $part['parentDisk'] = $data;
311       $objs[$part['cn']] = $part;
312     }
314     // Walk through physical partition combinations and build up 
315     //  user friendly list with partition details.
316     $list = array();
317     foreach($this->lvmDevices as $device){
319       // We've a html select box here, add spaces for better readability
320       $str = $device;
321       $str = preg_replace("/ /","&nbsp;",str_pad($str,20," "));
323       // Add disk/partition details.
324       if(isset($objs[$device])){
325         if(isset($objs[$device]['FAIpartitionSize'])){
326           if($objs[$device]['parentDisk']['FAIdiskType'] == "raid"){
327             $str .= _("Disks").":&nbsp;";
328             $str .= preg_replace("/(:spare|:missing)/i","",$objs[$device]['FAIpartitionSize']);
329           }else{
330             $str .= _("Size").":&nbsp;";
331             $str .= $objs[$device]['FAIpartitionSize'];
332           } 
333         }
334       }
335       $list[$device] = $str;
336     }
337     return($list);
338   }
340  
341   /* Returns a list of available partitions that are useable in 
342    *  lvm disk setups.
343    */ 
344   function getAvailablePartitions()
345   {
347     $may = $used = array();
348     foreach($this->parent->disks as $disk){
350       // Skip ourselves
351       if($disk['cn'] == $this->DISKcn) continue;
353       // Add partition from lvm combinations
354       if($disk['FAIdiskType'] == "lvm"){
355         $used = array_merge($used,$disk['FAIlvmDevice']);
356       }
358       foreach($disk['partitions'] as $key => $part){
360         // Add disks of raid arrays, to the used list.
361         if($disk['FAIdiskType'] == "raid"){
362           foreach(explode(",",$part['FAIpartitionSize']) as $rDevice){
363             $used[] = preg_replace("/:.*$/i","",$rDevice);
364           }
365         }
367         // Collect all available disks
368         if($disk['FAIdiskType'] == "disk"){
369           $name = $part['cn'];
370           if(!isset($this->lvmDevices[$name])){
371             $may[] = $name;
372           }
373         }
374       }
375     }
377     // Check which of the available disks are unused.
378     $ret = array();
379     foreach($may as $val){
380       if(!in_array_strict($val,$used)){
381         $ret[$val] = $val;
382       }
383     }
384     return($ret);
385   }
388   /* Remove the selected partition and shift the following partitions 
389    *  to fill the gap.
390    * Additionally update the partition numbers correspondingly.
391    *  (Checks if the partition is in use, too)
392    */
393   function removePartition($id)
394   {
395     $start = false;
397     /* Create a list of all partitions that are used in
398      *  lvm or raid compilations.
399      */
400     $list = array();
401     foreach($this->parent->disks as $dname => $disk){
402       if($disk['FAIdiskType'] != "disk"){
403         if($disk['FAIdiskType'] == "lvm"){
404           foreach($disk['FAIlvmDevice'] as $partname){
405             $list[preg_replace("/:.*$/","",$partname)][] = $disk;
406           }
407         }
408         foreach($disk['partitions'] as $partkey => $part){
409           if($disk['FAIdiskType'] == "raid"){
410             foreach(explode(",",$part['FAIpartitionSize']) as $partname){
411               $list[preg_replace("/:.*$/","",$partname)][] = $disk;
412             }
413           }
414         }
415       }
416     }
418     /* Now that we've a list of all partition references, lets check if
419      *  one of the partitions we are going to remove is still in use.
420      */
421     if(isset($list[$this->partitions[$id]['cn']])){
422       $used = array();
423       foreach($list[$this->partitions[$id]['cn']] as $disk){
424         $used[$disk['cn']] = $disk['cn'];
425       }
426       $used = implode(",",$used);
427       msg_dialog::display(_("Error"),
428           sprintf(_("The disk cannot be deleted while it is used in the '%s' disk definition!"),
429             $used), ERROR_DIALOG);
430     }else{
431       unset($this->partitions[$id]);
432     }
433   }
435   
436   function get_free_partition_number()
437   {
438     $used = array();
439     foreach($this->partitions as $key => $part){
440       $used[$key] = $part['FAIpartitionNr'];
441     }
442     $id = 1;
443     while(in_array_strict($id,$used) && $id < 16 ){
444       $id++;
445     }
446     return($id);
447   }
451   /* Add or update a partition 
452    */
453   function updatePartition($part)
454   {
455     if(!isset($part['FAIpartitionNr']) || $part['FAIpartitionNr'] == "undefined"){
456       $part['FAIpartitionNr'] = $this->get_free_partition_number();
457     }
459     /* Update the disk cn -       
460      * Do NOT touch the partition 'cn' in case of lvm or raid devices. 
461      */
462     if($this->FAIdiskType == "disk"){
463       $part['cn'] = $this->DISKcn.$part['FAIpartitionNr'];
464     }
466     /* Check if we've to update partition names of lvm compilations.
467      */ 
468     if($this->FAIdiskType == "lvm"){
469       if(isset($this->partitions[$part['FAIpartitionNr']])){
470         $old_cn = $this->partitions[$part['FAIpartitionNr']]['cn'];
471         $new_cn = $part['cn'];
472         if(isset($this->lvmDevices[$old_cn])){
473           unset($this->lvmDevices[$old_cn]);
474           $this->lvmDevices[$new_cn] = $new_cn;
475         }
476       }
477     }
479     /* Set raid names to md#
480      */ 
481     if($this->FAIdiskType == "raid"){
482       $part['cn'] = 'md'.$part['FAIpartitionNr'];
483     }
485     $this->partitions[$part['FAIpartitionNr']] = $part;
486   }
489   /* This method generates the partition listing with all necessary info,
490    *  depending on the disk type.
491    * The list is of type divSelectBox.
492    */
493   function generateParts()
494   {
495     $divlist = new divSelectBox("DiskEntries"); 
496     foreach($this->partitions as $key => $part){
498       // Create default table cols 
499       $cn =array(
500           "string" => "<a href='?plug=".$_GET['plug']."&amp;act=editPart&amp;id={$key}'>".$part['cn']."</a>",
501           "attach" => "style='width:160px;'");
502       $desc =array(
503           "string" => "<a href='?plug=".$_GET['plug']."&amp;act=editPart&amp;id={$key}'>".
504           $part['description']."</a>",
505           "attach" => "style='width:200px;'");
506       $number =array(
507           "string" => $part['FAIpartitionNr'],
508           "attach" => "style='width:20px;'");
509       $size   =array(
510           "string" => $part['FAIpartitionSize'],
511           "attach" => "style='width:100px;'");
512       $type   =array(
513           "string" => $part['FAIpartitionType'],
514           "attach" => "style='width:80px;'");
516       // Remove encryption info from the mount point.
517       $mnt = $part['FAImountPoint'];
518       if(preg_match("/:encrypt/", $mnt)){
519         $mnt = preg_replace("/:encrypt/","",$mnt);
520       }
521       $mntp   =array("string" => $mnt);
523       // create human readable strings out of the flags.
524       $opt = "";
525       if(isset($part['encrypted']) && $part['encrypted']){
526         $opt.= "&nbsp;"._("encrypted").", ";
527       }      
528       if(isset($part['bootable']) && $part['bootable']){
529         $opt.= "&nbsp;"._("bootable").", ";
530       }      
531       if(isset($part['preserve']) && $part['preserve']){
532         $opt.= "&nbsp;"._("preserve").":&nbsp;".$part['preserveType'].", ";
533       }     
535       // Combine options to a single table col. 
536       $opt    =array(
537           "string" => "<i>".preg_replace('/, $/',"",$opt)."</i>");
539       // Depending on the FAIstatus (freeze?) we will display different options. 
540       // We can't remove freezed branches -> Hide remove button.
541       if(!preg_match("/freeze/", $this->FAIstate)){
542         $action =array(
543             "string" => "<input type='image' src='images/lists/edit.png' name='EditPartition_".$key."'>".
544             "<input type='image' src='images/lists/trash.png' name='RemovePartition_".$key."'>",
545             "attach" => "style='width:40px; border-right: 0px;'");
546       }else{
547         $action =array(
548             "string" => "<input type='image' src='images/lists/edit.png' name='EditPartition_".$key."'>",
549             "attach" => "style='width:40px; border-right: 0px;'");
550       }
552       // Build up info table, depending on the disk type. 
553       if($this->FAIdiskType == "lvm"){ 
554         $fields = array($cn,$desc,$mntp,$opt,$size, $action);
555       }elseif($this->FAIdiskType == "raid"){
556         $raid_str = $part['FAIpartitionType']." (".$part['FAIpartitionSize'].")";
557         $raid = array("string" => $raid_str);
558         $fields = array($cn,$desc,$raid,$mntp,$opt,$action);
559       }else{
560         $fields = array($desc,$type,$mntp,$opt,$size,$action);
561       }
562       $divlist->AddEntry($fields);
563     }
564     return($divlist->DrawList());    
565   }
568   function save()
569   {
570     $tmp = array();
571     $tmp['cn']          = $this->DISKcn;
573     /* Attach partitions. 
574      * And prepare names and numbers.
575      */
576     foreach($this->partitions as $key=>$val) {
577       $this->partitions[$key]['FAIpartitionNr']=$key;
578       if($this->FAIdiskType == "disk"){
579         $this->partitions[$key]['cn'] = $this->DISKcn.$key;
580       }elseif($this->FAIdiskType == "lvm"){
581         $this->partitions[$key]['FAIpartitionType'] = 'lvm';
582       }
583     }
585     $tmp['description'] = $this->DISKdescription;
586     $tmp['partitions']  = $this->partitions;
587     $tmp['FAIdiskType'] = $this->FAIdiskType;
589     // Add lvm devices if available.
590     $tmp['FAIlvmDevice'] = array();
591     foreach($this->lvmDevices as $dev){
592       $tmp['FAIlvmDevice'][] = $dev;
593     } 
595     /* Assemble flags */
596     $tmp['FAIdiskOption'] = array("fstabkey:".$this->fstabkey, "disklabel:".$this->disklabel);
598     /* If hdd name has changed, tell partitionTable to rename it */
599     if(($this->is_edit)&&($this->old_cn != $this->DISKcn)){
600       $tmp['rename']['from']  = $this->old_cn;
601       $tmp['rename']['to']    = $this->DISKcn;
602     }
604     // Build up disk options 
605     $bootable = "";
606     $resize = "";
607     $preserve_always = "";
608     $preserve_reinstall = "";
610     /* Assemble boot, resize and preserve flags 
611      */
612     foreach($tmp['partitions'] as $id => $part){
613       if(isset($part['bootable']) && $part['bootable']){
614         $bootable .= $id.",";
615       }
616       if(isset($part['resize']) && $part['resize']){
617         $resize .= $id.",";
618       }
619       if(isset($part['preserve']) && $part['preserve']){
620         if($part['preserveType'] == "always"){
621           $preserve_always .= $id.",";
622         }else{
623           $preserve_reinstall .= $id.",";
624         }
625       }
627       // Unset non valid attributes 
628       foreach(array("bootable","encrypted","preserve","preserveType","resize","FAIdiskType") as $attr){
629         if(isset($tmp['partitions'][$id][$attr])){
630           unset($tmp['partitions'][$id][$attr]);
631         }
632       }
633     }    
635     /* Assembe disk flags
636      */
637     if(!empty($bootable)){
638       $tmp['FAIdiskOption'][] = "bootable:".trim($bootable,",");
639     }
640     if(!empty($resize)){
641       $tmp['FAIdiskOption'][] = "resize:".trim($resize,",");
642     }
643     if(!empty($preserve_always)){
644       $tmp['FAIdiskOption'][] = "preserve_always:".trim($preserve_always,",");
645     }
646     if(!empty($preserve_reinstall)){
647       $tmp['FAIdiskOption'][] = "preserve_reinstall:".trim($preserve_reinstall,",");
648     }
650     return($tmp);
651   }
654   /* Save data to object */
655   function save_object()
656   {
657     if((isset($_POST['TableEntryFrameSubmitted'])) && !preg_match("/freeze/", $this->FAIstate) ){
658       plugin::save_object();
660       // Save posted disk label and fstab key
661       if (isset($_POST['disklabel']) && preg_match("/^(msdos|gpt)$/", $_POST['disklabel'])){
662         $this->disklabel= $_POST['disklabel'];
663       }
664       if (isset($_POST['fstabkey']) && preg_match("/^(device|label|uuid)$/", $_POST['fstabkey'])){
665         $this->fstabkey= $_POST['fstabkey'];
666       }
667     }
668   }
671   /* Check supplied data */
672   function check()
673   {
674     /* Call common method to give check the hook */
675     $message= plugin::check();
676   
677     /* Check for an empty disk name */
678     $d = trim($this->DISKcn);
679     if($d == "" ){
680       $message[] = msgPool::required(_("Name"));
681     }
682     if(preg_match("/[^a-z0-9_\-]/i",$d)){
683       $message[] = msgPool::invalid(_("Name"),$d,"/[a-z0-9_\-]/i");
684     }
686     return ($message);
687   }
690   /* Checks the disk combinations.
691    * 
692    */  
693   function check_disks($disk_to_add = array())
694   {
695     $msgs = array();
697     /* Check 'disk' combinations. 
698      *  - There can be four primary partitions.
699      *  - If there is at least one 'logical' partition, then there can be only 
700      *     three 'primary' partitions.
701      */    
702     if($this->FAIdiskType == "disk"){
703      
704       $types = array('logical' => array(), 'primary' => array());
705       $types[$disk_to_add['FAIpartitionType']][$disk_to_add['FAIpartitionNr']] = 1;
706       foreach($this->partitions as $key => $part){
707         $types[$part['FAIpartitionType']][$part['FAIpartitionNr']] = 1;
708       }
710       // There can only be four primary partitions per disk - without any logical partition.
711       if(count($types['logical']) == 0){
712         if(count($types['primary']) > 4){
713           $msgs[] = _("You have more than four primary partition table entries in your configuration, please check your configuration twice.");
714         }
715       }else{
716         if(count($types['primary']) > 3){
717           $msgs[] = _("You cannot have more than three primary partition while using logical partitions, please check your configuration twice.");
718         }
719       }
720     }
722     return($msgs);
723   }  
726   /* Return plugin informations for acl handling */
727   static function plInfo()
728   {
729     return (array(
730           "plShortName" => _("Partition table entry"),
731           "plDescription" => _("FAI partition table entry"),
732           "plSelfModify"  => FALSE,
733           "plDepends"     => array(),
734           "plPriority"    => 27,
735           "plSection"     => array("administration"),
736           "plCategory"    => array("fai"),
737           "plProvidedAcls" => array(
738             "DISKcn"           => _("Name"),
739             "DISKdescription"  => _("Description"),
740             "DISKFAIdiskOption"  => _("Disk options"),
741             "FAIpartitionType"  => _("Partition type"),
742             "FAIpartitionNr"    => _("Partition no."),
743             "FAIfsType"         => _("File system type"),
744             "FAImountPoint"     => _("Mount point"),
745             "FAIpartitionSize"  => _("Partition size"),
746             "FAImountOptions"   => _("Mount options"),
747             "FAIfsOptions"      => _("File system options"),
748             "FAIpartitionFlags" => _("Partition flags"))
749           ));
750   }
751  
754 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
755 ?>